我在处理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
帮助将不胜感激:)