sparse-checkout set on Windows git bash adds path to git install dir to exclude patterns

162 views
Skip to first unread message

Robert Jessop

unread,
Aug 26, 2022, 7:21:43 AM8/26/22
to git-for-windows

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

git sparse-checkout set --no-cone '/*' '!/Some/Path/To/Exclude'

git sparse-checkout list


What did you expect to happen? (Expected behavior)

/*

!/Some/Path/To/Exclude


What happened instead? (Actual behavior)

/*

!C:/Program Files/Git/Some/Path/To/Exclude


What's different between what you expected and what actually happened?

The path to git's install directory has been prefixed to my sparse checkout exclude patterns


Anything else you want to add:

This behaviour occurs on Windows and does not occur on Mac


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.37.2.windows.2

cpu: x86_64

built from commit: c5597badf94101f0076e6667edee120ab1ee5bac

sizeof-long: 4

sizeof-size_t: 8

shell-path: /bin/sh

feature: fsmonitor--daemon

uname: Windows 10.0 18363

compiler info: gnuc: 12.1

libc info: no libc information available

$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe



[Enabled Hooks]

post-checkout

post-commit

post-merge

pre-push

Johannes Schindelin

unread,
Aug 29, 2022, 9:45:30 AM8/29/22
to Robert Jessop, git-for-windows
Hi Robert,

On Thu, 25 Aug 2022, 'Robert Jessop' via git-for-windows wrote:

> What did you do before the bug happened? (Steps to reproduce your issue)
>
> git sparse-checkout set --no-cone '/*' '!/Some/Path/To/Exclude'
>
> git sparse-checkout list
>
>
> What did you expect to happen? (Expected behavior)
>
> /*
>
> !/Some/Path/To/Exclude
>
>
> What happened instead? (Actual behavior)
>
> /*
>
> !C:/Program Files/Git/Some/Path/To/Exclude

This seems to be an instance of the following item from the Known Issues
https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#known-issues:

- 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
Reply all
Reply to author
Forward
0 new messages