git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Leading slash exclusion does not with git clean on Windows
@ 2022-02-16 14:15 Adam Kapos
  2022-03-09 23:02 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Kapos @ 2022-02-16 14:15 UTC (permalink / raw)
  To: git

I came across an issue where the leading slash exclusion pattern does
not work with git clean on Windows.

What did you do before the bug happened? (Steps to reproduce your issue)

Run the following commands:
1. mkdir foo
2. mkdir -p bar/foo
3. git clean -fdx --exclude /foo

What did you expect to happen? (Expected behavior)
The root-level directory is not removed because it's excluded

Removing bar/

What happened instead? (Actual behavior)
The root level directory is removed:

Removing bar/
Removing foo/


What's different between what you expected and what actually happened?
The root-level exclusion doesn't work

Anything else you want to add:

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.35.1.windows.2, 2.31.1.windows.1
cpu: x86_64
built from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 22000
compiler info: gnuc: 10.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe


[Enabled Hooks]
post-commit
post-checkout
post-merge
pre-push

-- 




**Confidentiality**
The
 information contained in this e-mail is 
confidential, may be privileged
 and is intended solely for the use of the 
named addressee. Access to 
this e-mail by any other person is not 
authorised. If you are not the 
intended recipient, you should not 
disclose, copy, distribute, take any 
action or rely on it and you should 
please notify the sender by reply. 
Any opinions expressed are not 
necessarily those of the company.

We
 may monitor all incoming and 
outgoing emails in line with current 
legislation. We have taken steps to 
ensure that this email and 
attachments are free from any virus, but it 
remains your responsibility 
to ensure that viruses do not adversely affect 
you.



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

* Re: Leading slash exclusion does not with git clean on Windows
  2022-02-16 14:15 Leading slash exclusion does not with git clean on Windows Adam Kapos
@ 2022-03-09 23:02 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2022-03-09 23:02 UTC (permalink / raw)
  To: Adam Kapos; +Cc: git

Hi Adam,


On Wed, 16 Feb 2022, Adam Kapos wrote:

> I came across an issue where the leading slash exclusion pattern does
> not work with git clean on Windows.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> Run the following commands:
> 1. mkdir foo
> 2. mkdir -p bar/foo
> 3. git clean -fdx --exclude /foo
>
> What did you expect to happen? (Expected behavior)
> The root-level directory is not removed because it's excluded
>
> Removing bar/
>
> What happened instead? (Actual behavior)
> The root level directory is removed:
>
> Removing bar/
> Removing foo/
>
>
> What's different between what you expected and what actually happened?
> The root-level exclusion doesn't work

As mentioned in the Known Issues section of Git for Windows' Release Notes
(https://github.com/git-for-windows/build-extra/blob/master/ReleaseNotes.md#known-issues,
also available via Start Menu>Git>Git Release Notes):

	* If you specify command-line options starting with a slash,
	  POSIX-to-Windows path conversion will kick in converting e.g.
	  "`/usr/bin/bash.exe`" to "`C:\Program
	  Files\Git\usr\bin\bash.exe`". When that is not desired -- e.g.
	  "`--upload-pack=/opt/git/bin/git-upload-pack`" or "`-L/regex/`"
	  -- you need to set the environment variable `MSYS_NO_PATHCONV`
	  temporarily, like so:

	  > `MSYS_NO_PATHCONV=1 git blame -L/pathconv/ msys2_path_conv.cc`

	  Alternatively, you can double the first slash to avoid
	  POSIX-to-Windows path conversion, e.g. "`//usr/bin/bash.exe`".

Ciao,
Johannes

> Anything else you want to add:
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.35.1.windows.2, 2.31.1.windows.1
> cpu: x86_64
> built from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Windows 10.0 22000
> compiler info: gnuc: 10.2
> libc info: no libc information available
> $SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe
>
>
> [Enabled Hooks]
> post-commit
> post-checkout
> post-merge
> pre-push
>
> --
>
>
>
>
> **Confidentiality**
> The
>  information contained in this e-mail is
> confidential, may be privileged
>  and is intended solely for the use of the
> named addressee. Access to
> this e-mail by any other person is not
> authorised. If you are not the
> intended recipient, you should not
> disclose, copy, distribute, take any
> action or rely on it and you should
> please notify the sender by reply.
> Any opinions expressed are not
> necessarily those of the company.
>
> We
>  may monitor all incoming and
> outgoing emails in line with current
> legislation. We have taken steps to
> ensure that this email and
> attachments are free from any virus, but it
> remains your responsibility
> to ensure that viruses do not adversely affect
> you.
>
>
>

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

end of thread, other threads:[~2022-03-09 23:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 14:15 Leading slash exclusion does not with git clean on Windows Adam Kapos
2022-03-09 23:02 ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).