2

After doing

git commit -am '/logs whatever'

I end up with commit message C:/Program Files/Git/logs whatever. How does this happen? I did not succeed in finding any related information by googling things like 'git commit message autocomplete'.

$ git --version
git version 2.20.1.windows.1

$ bash --version
GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)

Additional investigation The path does not have to exist, it's just appended to C:/Program Files/Git, but if it exists, things can be different (notice /usr/, both paths exist):

$ git commit -am '/bin/git.exe something'
[master 22f9915] C:/Program Files/Git/usr/bin/git.exe something
1
  • Strange, I did not reproduced the issue, using single or double quotes, with a CMD or a bash session... Commented Feb 20, 2019 at 5:48

1 Answer 1

1

Apparently, this is a known issue. Johannes Schindelin, maintainer of Git for Windows, describes it and possible fixes:

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.

Even though in your case this is not a path as such, just the fact that the message starts with a slash must be triggering this behavior.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.