我在处理filenames
它们的空间时遇到了麻烦。
我使用下面的部分script
来获取文件push onto
夹中包含的文件,zip
然后再unzip
获取文件。
tempdir=$(mktemp -d /apps/sample/XXXX)
while read oldrev newrev refname
do
commits=`git rev-list $oldrev..$newrev`
for commit in $commits
do
git diff-tree -z --no-commit-id --name-only -r $commit | xargs -0 git archive -o $tempdir/list.zip HEAD:
unzip $tempdir/list.zip -d $scandir
rm -rf /apps/sample/list.zip
done
done
exit 0
在下面的示例中,我添加并提交了文件SAMPLE FILE.txt
. 问题是当git archive
命令遇到空格时,我收到以下错误。
[root@inba2 repo]# git push origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 296 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
remote: fatal: path not found: SAMPLE FILE.txt
remote: Archive: /apps/sample/l7Im/list.zip
remote: End-of-central-directory signature not found. Either this file is not
remote: a zipfile, or it constitutes one disk of a multi-part archive. In the
remote: latter case the central directory and zipfile comment will be found on
remote: the last disk(s) of this archive.
remote: unzip: cannot find zipfile directory in one of /apps/sample/l7Im/list.zip or
remote: /apps/sample/l7Im/list.zip.zip, and cannot find /apps/sample/l7Im/list.zip.ZIP, period
git 版本是 1.7.1
bash 版本是 4.1.2
帮助将不胜感激:)