git'archive'命令因以下错误而停止:
致命:pathspec'文件路径'与任何文件都不匹配。
尝试将文件路径包装在引号或双引号内并不能解决问题:
git archive -o upload.zip a2c79b2 $(git diff --name-only 33ab7ac^.. a2c79b2 --diff-filter=ACMRTUX | awk '{print "\x27"$0"\x27"}')
git archive -o upload.zip a2c79b2 $(git diff --name-only 33ab7ac^.. a2c79b2 --diff-filter=ACMRTUX | awk '{print "\x22"$0"\x22"}')
尝试在空格之前放置bakslash或正斜杠也无济于事:
git archive -o upload.zip a2c79b2 $(git diff --name-only 33ab7ac^.. a2c79b2 --diff-filter=ACMRTUX | awk '{gsub(/ /,"\\ ");print}')
有没有办法将包含空格的文件路径发送到'archive'命令,允许它正确解析它们?
提前多多感谢。
答案 0 :(得分:1)
git archive -o upload.zip a2c79b2 $(git diff --name-only 33ab7ac^.. a2c79b2 --diff-filter=ACMRTUX | sed 's/ /\xA0/g')