Repository navigation
Description
Setup
- Which version of Git for Windows are you using? 32-bit or 64-bit? Include the
output ofgit versionas well.
Windows 8 x64, running 64-bit git
$ git --version
git version 2.7.2.windows.1
- What options did you set as part of the installation? Or did you choose the
defaults?
File caching set to enabled
- Any other interesting things about your environment that might be related
to the issue you're seeing?
Happens on Windows only, works fine on Ubuntu 15
Details
- Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other
Default bash shell
- What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
$ git show origin/develop:.gitmodules
- What did you expect to occur after running these commands?
I expect the contents of the .gitmodules file on ref origin/develop to be printed.
- What actually happened instead?
No output
Note on Ubuntu 15 I get this output:
$ GIT_TRACE=1 git show origin/develop:.gitmodules
10:49:09.589883 git.c:348 trace: built-in: git 'show' 'origin/develop:.gitmodules'
10:49:09.590826 run-command.c:338 trace: run_command: 'less'
I obtained this output by running ssh user@ubuntumachine FROM an actual Git Terminal on my Windows machine. So this should rule out any issue with the terminal itself, right?
The corresponding command run in a repository ON my windows machine using the git terminal:
$ GIT_TRACE=1 git show origin/develop:.gitmodules
10:48:00.961265 git.c:348 trace: built-in: git 'show' 'origin\develop;.gitmodules'
10:48:00.968267 run-command.c:343 trace: run_command: 'less'
The only observable difference I see is that on Windows a ; (semicolon) is used in the trace output, but a : (colon) used on Ubuntu. Note that show works fine as long as the file doesn't begin with a period. For example, both platforms output fine if I do git show origin/develop:CMakeLists.txt.
Activity
whoisj commentedon Mar 18, 2016
Confirmed.
Works as expected from PowerShell, but with Git Bash there is no output.
dscho commentedon Apr 2, 2016
The culprit is the POSIX <-> Windows path conversion, mentioned in our release notes:
Granted, it does not talk about colons followed by a dot per se, but it is essentially the same problem. To the Bash, you see, it looks as if you are passing a path list of the form
<path1>:<path2>:<path3>, using the standard POSIX path separator:, and it sees that you want to pass this path list to the non-POSIX programgit.exe, so it assumes thatgit.exewants this path list to have the standard Windows path separator;. TheMSYS_NO_PATHCONV=1trick helps in this case. Not using the Bash would also help in this case, of course.dscho commentedon Apr 2, 2016
As changing the POSIX <-> Windows path conversion according to this ticket's wishes would break more things than it would fix, I am closing this as "wontfix".
rcdailey commentedon Apr 2, 2016
rcdailey commentedon Apr 3, 2016
drizzd commentedon Feb 20, 2017
Note that
MSYS_NO_PATHCONV=1works only with git-for-windows patches to the msys2-runtime. Users of the upstream msys2-runtime can useMSYS2_ARG_CONV_EXCL='*'instead, documented at https://github.com/msys2/msys2/wiki/Porting#filesystem-namespaces.@dscho I agree that changing the path conversion would only cause issues elsewhere. Just for the record, here is an example that would break:
But if
origin\develop;.gitmodulesdoes not match a file literally, we could interpret it as<rev>;<path>, same as we interpretorigin/develop:.gitmodulesas<rev>:<path>if it does not match a file.fix(windows): 绕过 MSYS2 路径转换——目录名带点被拆成路径段致 fetch failed (issue #10)