windows - git archive "The input line is too long. " error in batch file -


from various sources managed modify script found create archive of files added or changed between 2 changesets. batch script follows:

setlocal enabledelayedexpansion set output= /f "delims=" %%a in ('git diff --name-only %1 %2') ( set output=!output! "%%a" ) git archive -o export.zip head %output% endlocal 

this has worked great until today , of sudden getting following error back:

the input line long. syntax of command incorrect.

i've confirmed cause of result of %output% long not sure if or how can work around this?

if wanted export changed files between 2 commits, why not (instead on relying on dos variable being set, , being potentially long) a:

git archive --output=file.zip head $(git diff --name-only sha1 sha2) 

since unix syntax, need call sh.exe included in git windows (as mention in "what exact meaning of git bash?")

the op pronotion proposes in comments:

"c:\program files (x86)\git\bin\sh.exe" --login -i -c "git archive -o export.zip head $(git diff --name-only %1 %2)"  

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -