{"thread":{"id":"57425","subject":"Leading slash exclusion does not with git clean on Windows","startedAt":"2022-02-16T14:15:18Z","lastAt":"2022-03-09T23:02:21Z","messageCount":2,"participants":["Adam Kapos","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"448596","messageId":"CAMwvdPQLMK2-CPyLqSKBWZjEi+6o2iaj_=C2VnJA=sV5GUV47Q@mail.gmail.com","threadId":"57425","inReplyTo":null,"subject":"Leading slash exclusion does not with git clean on Windows","fromName":"Adam Kapos","fromEmail":"adam@yousician.com","sentAt":"2022-02-16T14:15:04Z","receivedAt":"2022-02-16T14:15:18Z","isPatch":false,"sender":{"key":"adam@yousician.com","avatar":null},"body":"I came across an issue where the leading slash exclusion pattern does\nnot work with git clean on Windows.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nRun the following commands:\n1. mkdir foo\n2. mkdir -p bar/foo\n3. git clean -fdx --exclude /foo\n\nWhat did you expect to happen? (Expected behavior)\nThe root-level directory is not removed because it's excluded\n\nRemoving bar/\n\nWhat happened instead? (Actual behavior)\nThe root level directory is removed:\n\nRemoving bar/\nRemoving foo/\n\n\nWhat's different between what you expected and what actually happened?\nThe root-level exclusion doesn't work\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.35.1.windows.2, 2.31.1.windows.1\ncpu: x86_64\nbuilt from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 22000\ncompiler info: gnuc: 10.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\npost-commit\npost-checkout\npost-merge\npre-push\n\n-- \n\n\n\n\n**Confidentiality**\nThe\n information contained in this e-mail is \nconfidential, may be privileged\n and is intended solely for the use of the \nnamed addressee. Access to \nthis e-mail by any other person is not \nauthorised. If you are not the \nintended recipient, you should not \ndisclose, copy, distribute, take any \naction or rely on it and you should \nplease notify the sender by reply. \nAny opinions expressed are not \nnecessarily those of the company.\n\nWe\n may monitor all incoming and \noutgoing emails in line with current \nlegislation. We have taken steps to \nensure that this email and \nattachments are free from any virus, but it \nremains your responsibility \nto ensure that viruses do not adversely affect \nyou.\n\n\n"},{"id":"450947","messageId":"nycvar.QRO.7.76.6.2203092358510.357@tvgsbejvaqbjf.bet","threadId":"57425","inReplyTo":"CAMwvdPQLMK2-CPyLqSKBWZjEi+6o2iaj_=C2VnJA=sV5GUV47Q@mail.gmail.com","subject":"Re: Leading slash exclusion does not with git clean on Windows","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-03-09T23:02:09Z","receivedAt":"2022-03-09T23:02:21Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Adam,\n\n\nOn Wed, 16 Feb 2022, Adam Kapos wrote:\n\n> I came across an issue where the leading slash exclusion pattern does\n> not work with git clean on Windows.\n>\n> What did you do before the bug happened? (Steps to reproduce your issue)\n>\n> Run the following commands:\n> 1. mkdir foo\n> 2. mkdir -p bar/foo\n> 3. git clean -fdx --exclude /foo\n>\n> What did you expect to happen? (Expected behavior)\n> The root-level directory is not removed because it's excluded\n>\n> Removing bar/\n>\n> What happened instead? (Actual behavior)\n> The root level directory is removed:\n>\n> Removing bar/\n> Removing foo/\n>\n>\n> What's different between what you expected and what actually happened?\n> The root-level exclusion doesn't work\n\nAs mentioned in the Known Issues section of Git for Windows' Release Notes\n(https://github.com/git-for-windows/build-extra/blob/master/ReleaseNotes.md#known-issues,\nalso available via Start Menu>Git>Git Release Notes):\n\n\t* If you specify command-line options starting with a slash,\n\t  POSIX-to-Windows path conversion will kick in converting e.g.\n\t  \"`/usr/bin/bash.exe`\" to \"`C:\\Program\n\t  Files\\Git\\usr\\bin\\bash.exe`\". When that is not desired -- e.g.\n\t  \"`--upload-pack=/opt/git/bin/git-upload-pack`\" or \"`-L/regex/`\"\n\t  -- you need to set the environment variable `MSYS_NO_PATHCONV`\n\t  temporarily, like so:\n\n\t  > `MSYS_NO_PATHCONV=1 git blame -L/pathconv/ msys2_path_conv.cc`\n\n\t  Alternatively, you can double the first slash to avoid\n\t  POSIX-to-Windows path conversion, e.g. \"`//usr/bin/bash.exe`\".\n\nCiao,\nJohannes\n\n> Anything else you want to add:\n>\n> Please review the rest of the bug report below.\n> You can delete any lines you don't wish to share.\n>\n>\n> [System Info]\n> git version:\n> git version 2.35.1.windows.2, 2.31.1.windows.1\n> cpu: x86_64\n> built from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb\n> sizeof-long: 4\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> feature: fsmonitor--daemon\n> uname: Windows 10.0 22000\n> compiler info: gnuc: 10.2\n> libc info: no libc information available\n> $SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n>\n>\n> [Enabled Hooks]\n> post-commit\n> post-checkout\n> post-merge\n> pre-push\n>\n> --\n>\n>\n>\n>\n> **Confidentiality**\n> The\n>  information contained in this e-mail is\n> confidential, may be privileged\n>  and is intended solely for the use of the\n> named addressee. Access to\n> this e-mail by any other person is not\n> authorised. If you are not the\n> intended recipient, you should not\n> disclose, copy, distribute, take any\n> action or rely on it and you should\n> please notify the sender by reply.\n> Any opinions expressed are not\n> necessarily those of the company.\n>\n> We\n>  may monitor all incoming and\n> outgoing emails in line with current\n> legislation. We have taken steps to\n> ensure that this email and\n> attachments are free from any virus, but it\n> remains your responsibility\n> to ensure that viruses do not adversely affect\n> you.\n>\n>\n>\n"}]}