With git version 1.7.7.1.msysgit.0 the following command
git am --keep-cr --whitespace=nowarn c:\test\*.patch
fails with message "C:\Program Files (x86)\Git/libexec/git-core\git-
am: line 182: c:\test\*.patch: No such file or directory"
While with git version 1.7.4 that works as expected. The error happens
when the command is ran directly from cmd.exe. Workaround for 1.7.7 is
to run command via git bash:
git am --keep-cr --whitespace=nowarn /c/test/*.patch
However we use git from cmd.exe and we need that fixed. I can try help
if somebody tell me where to start. It looks like on line 246 of file
"C:\Program Files (x86)\Git/libexec/git-core\git-am"
} < "$1" || clean_abort
$1 is not expanded to a list of files and applied like a ready to use
file name. But this is more a wild guess than real understanding.
Please help.
Sigh! Oh, the joys of Windows file name (non-)globbing.
Try reverting this commit: 45cfa3506b (MinGW: disable CRT command line
globbing). Or (if it is easier for you) patch your git binary so that
the variable _CRT_glob is initialized to 1 instead of 0.
-- Hannes
-Josh
Thats the bash way. It will iterate over the .patch files and call
that command with all the expanded filenames appended.
You could do something similar using no bash commands with maybe and
batchfile like:
for /f %I in (%1) do git am --keep-cr --whitespace=nowarn "%~I"
The issue is that Windows programs receive the command line
differently to unix programs. On windows no expansion is done by the
shell before the command line is passed to the application. On unix,
the shell expands glob arguments like *.patch into a list of filenames
before running the program with the expanded command line arguments.
Obviously this can be fixed - but doing so breaks other things so
someone always looses out. If you want, you could make a shell script
called git-amx and put it on your PATH that simply includes the line
above as below and it will be callable as 'git amx *.patch'
#!/bin/sh
find c:/test/*.patch | xargs git am --keep-cr --whitespace=nowarn
It's quite easy to add new commands to git like this (or as aliases too).