git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* Git pathspecs difference in behavior between linux (wsl) and windows
@ 2021-05-13  6:57 Alexandre Remy
  2021-05-13  7:49 ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Remy @ 2021-05-13  6:57 UTC (permalink / raw)
  To: git

Hi,

I do not understand why the same command works on linux and not on
windows. Is the pathspecs syntax differ or there is a problem on the
git windows version?

* On windows (git version 2.31.1.windows.1)

git status -- 'src/test.js'
On branch master
nothing to commit, working tree clean


* On linux (wsl: git version 2.25.1)

git status -- 'src/test.js'
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/test.js
A classic git status gives the same result between linux and windows
(with correct file detected).

Regards,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Git pathspecs difference in behavior between linux (wsl) and windows
  2021-05-13  6:57 Git pathspecs difference in behavior between linux (wsl) and windows Alexandre Remy
@ 2021-05-13  7:49 ` Johannes Sixt
  2021-05-13  8:05   ` Alexandre Remy
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2021-05-13  7:49 UTC (permalink / raw)
  To: Alexandre Remy; +Cc: git

Am 13.05.21 um 08:57 schrieb Alexandre Remy:
> Hi,
> 
> I do not understand why the same command works on linux and not on
> windows. Is the pathspecs syntax differ or there is a problem on the
> git windows version?
> 
> * On windows (git version 2.31.1.windows.1)
> 
> git status -- 'src/test.js'
> On branch master
> nothing to commit, working tree clean
> 
> 
> * On linux (wsl: git version 2.25.1)
> 
> git status -- 'src/test.js'
> On branch master
> Changes not staged for commit:
>   (use "git add <file>..." to update what will be committed)
>   (use "git restore <file>..." to discard changes in working directory)
>         modified:   src/test.js
> A classic git status gives the same result between linux and windows
> (with correct file detected).

Which shell did you use to invoke the Windows version? If it was from
CMD or PowerShell, then you must not put the name in single-quotes:

   git status -- src/test.js

The reason is that the single-quote does not have a special meaning for
CMD and PowerShell like it does for a POSIX shell.

-- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Git pathspecs difference in behavior between linux (wsl) and windows
  2021-05-13  7:49 ` Johannes Sixt
@ 2021-05-13  8:05   ` Alexandre Remy
  2021-05-13  9:31     ` Alexandre Remy
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Remy @ 2021-05-13  8:05 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Thank you, that was that. I was misled by the doc and the single-quote
which indeed is specific to the linux platform.

Thank you again for your prompt reply.

Le jeu. 13 mai 2021 à 09:49, Johannes Sixt <j6t@kdbg.org> a écrit :
>
> Am 13.05.21 um 08:57 schrieb Alexandre Remy:
> > Hi,
> >
> > I do not understand why the same command works on linux and not on
> > windows. Is the pathspecs syntax differ or there is a problem on the
> > git windows version?
> >
> > * On windows (git version 2.31.1.windows.1)
> >
> > git status -- 'src/test.js'
> > On branch master
> > nothing to commit, working tree clean
> >
> >
> > * On linux (wsl: git version 2.25.1)
> >
> > git status -- 'src/test.js'
> > On branch master
> > Changes not staged for commit:
> >   (use "git add <file>..." to update what will be committed)
> >   (use "git restore <file>..." to discard changes in working directory)
> >         modified:   src/test.js
> > A classic git status gives the same result between linux and windows
> > (with correct file detected).
>
> Which shell did you use to invoke the Windows version? If it was from
> CMD or PowerShell, then you must not put the name in single-quotes:
>
>    git status -- src/test.js
>
> The reason is that the single-quote does not have a special meaning for
> CMD and PowerShell like it does for a POSIX shell.
>
> -- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Git pathspecs difference in behavior between linux (wsl) and windows
  2021-05-13  8:05   ` Alexandre Remy
@ 2021-05-13  9:31     ` Alexandre Remy
  2021-05-13 13:02       ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Remy @ 2021-05-13  9:31 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

I have an additional question, does double-quotes be safely used in
both windows (that's ok) and linux shell  for pathspecs (git status --
"src/test.js") in case of spaces in the path?

Le jeu. 13 mai 2021 à 10:05, Alexandre Remy
<alexandre.remy.contact@gmail.com> a écrit :
>
> Thank you, that was that. I was misled by the doc and the single-quote
> which indeed is specific to the linux platform.
>
> Thank you again for your prompt reply.
>
> Le jeu. 13 mai 2021 à 09:49, Johannes Sixt <j6t@kdbg.org> a écrit :
> >
> > Am 13.05.21 um 08:57 schrieb Alexandre Remy:
> > > Hi,
> > >
> > > I do not understand why the same command works on linux and not on
> > > windows. Is the pathspecs syntax differ or there is a problem on the
> > > git windows version?
> > >
> > > * On windows (git version 2.31.1.windows.1)
> > >
> > > git status -- 'src/test.js'
> > > On branch master
> > > nothing to commit, working tree clean
> > >
> > >
> > > * On linux (wsl: git version 2.25.1)
> > >
> > > git status -- 'src/test.js'
> > > On branch master
> > > Changes not staged for commit:
> > >   (use "git add <file>..." to update what will be committed)
> > >   (use "git restore <file>..." to discard changes in working directory)
> > >         modified:   src/test.js
> > > A classic git status gives the same result between linux and windows
> > > (with correct file detected).
> >
> > Which shell did you use to invoke the Windows version? If it was from
> > CMD or PowerShell, then you must not put the name in single-quotes:
> >
> >    git status -- src/test.js
> >
> > The reason is that the single-quote does not have a special meaning for
> > CMD and PowerShell like it does for a POSIX shell.
> >
> > -- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Git pathspecs difference in behavior between linux (wsl) and windows
  2021-05-13  9:31     ` Alexandre Remy
@ 2021-05-13 13:02       ` Johannes Sixt
  2021-05-13 20:08         ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2021-05-13 13:02 UTC (permalink / raw)
  To: Alexandre Remy; +Cc: git

Am 13.05.21 um 11:31 schrieb Alexandre Remy:
> I have an additional question, does double-quotes be safely used in
> both windows (that's ok) and linux shell  for pathspecs (git status --
> "src/test.js") in case of spaces in the path?

They can be used in both POSIX shell and Windows CMD and, I would
assume, also in the PowerShell. Note though, that there are subtle
differences when other special characters occur between double-quotes,
notably the backslash. Please use your favorite search engine to learn more.

-- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Git pathspecs difference in behavior between linux (wsl) and windows
  2021-05-13 13:02       ` Johannes Sixt
@ 2021-05-13 20:08         ` Junio C Hamano
  2021-05-13 21:03           ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2021-05-13 20:08 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Alexandre Remy, git

Johannes Sixt <j6t@kdbg.org> writes:

> Am 13.05.21 um 11:31 schrieb Alexandre Remy:
>> I have an additional question, does double-quotes be safely used in
>> both windows (that's ok) and linux shell  for pathspecs (git status --
>> "src/test.js") in case of spaces in the path?
>
> They can be used in both POSIX shell and Windows CMD and, I would
> assume, also in the PowerShell. Note though, that there are subtle
> differences when other special characters occur between double-quotes,
> notably the backslash. Please use your favorite search engine to learn more.

And a dollar sign, in addition to the backslash?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Git pathspecs difference in behavior between linux (wsl) and windows
  2021-05-13 20:08         ` Junio C Hamano
@ 2021-05-13 21:03           ` Johannes Sixt
  2021-05-13 21:17             ` Alexandre Remy
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2021-05-13 21:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Alexandre Remy, git

Am 13.05.21 um 22:08 schrieb Junio C Hamano:
> Johannes Sixt <j6t@kdbg.org> writes:
> 
>> Am 13.05.21 um 11:31 schrieb Alexandre Remy:
>>> I have an additional question, does double-quotes be safely used in
>>> both windows (that's ok) and linux shell  for pathspecs (git status --
>>> "src/test.js") in case of spaces in the path?
>>
>> They can be used in both POSIX shell and Windows CMD and, I would
>> assume, also in the PowerShell. Note though, that there are subtle
>> differences when other special characters occur between double-quotes,
>> notably the backslash. Please use your favorite search engine to learn more.
> 
> And a dollar sign, in addition to the backslash?

Granted, there's not a subtle, but a big difference how the dollar sign
is treated ;) but I don't want to write a tutorial here. Hence, my hint
towards a search engine.

-- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Git pathspecs difference in behavior between linux (wsl) and windows
  2021-05-13 21:03           ` Johannes Sixt
@ 2021-05-13 21:17             ` Alexandre Remy
  0 siblings, 0 replies; 8+ messages in thread
From: Alexandre Remy @ 2021-05-13 21:17 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git

Yep, I know, no problem. The primary subject is closed. thank you.

Le jeu. 13 mai 2021 à 23:03, Johannes Sixt <j6t@kdbg.org> a écrit :
>
> Am 13.05.21 um 22:08 schrieb Junio C Hamano:
> > Johannes Sixt <j6t@kdbg.org> writes:
> >
> >> Am 13.05.21 um 11:31 schrieb Alexandre Remy:
> >>> I have an additional question, does double-quotes be safely used in
> >>> both windows (that's ok) and linux shell  for pathspecs (git status --
> >>> "src/test.js") in case of spaces in the path?
> >>
> >> They can be used in both POSIX shell and Windows CMD and, I would
> >> assume, also in the PowerShell. Note though, that there are subtle
> >> differences when other special characters occur between double-quotes,
> >> notably the backslash. Please use your favorite search engine to learn more.
> >
> > And a dollar sign, in addition to the backslash?
>
> Granted, there's not a subtle, but a big difference how the dollar sign
> is treated ;) but I don't want to write a tutorial here. Hence, my hint
> towards a search engine.
>
> -- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-05-13 21:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13  6:57 Git pathspecs difference in behavior between linux (wsl) and windows Alexandre Remy
2021-05-13  7:49 ` Johannes Sixt
2021-05-13  8:05   ` Alexandre Remy
2021-05-13  9:31     ` Alexandre Remy
2021-05-13 13:02       ` Johannes Sixt
2021-05-13 20:08         ` Junio C Hamano
2021-05-13 21:03           ` Johannes Sixt
2021-05-13 21:17             ` Alexandre Remy

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git