fix make-git-snapshot.sh for git >= 1.7.9

Since git-1.7.9 it is not permitted to use 'git archive --remote=...'
with arbitrary sha1 refs. Only named refs are allowed.

See this git commit in git :-) :
ee27ca4a7 archive: don't let remote clients get unreachable commits
This commit is contained in:
Michal Schmidt 2012-02-10 09:34:36 +01:00
parent 3d15eff6df
commit da70c2af5e
1 changed files with 4 additions and 3 deletions

View File

@ -15,14 +15,15 @@ trap 'rm -rf $WORKDIR' exit
git clone $REFERENCE "$UPSTREAM" "$WORKDIR"
pushd "$WORKDIR" > /dev/null
read COMMIT_ID COMMIT_SHORTID COMMIT_TITLE <<EOGIT
$(git log ${HEAD}^..${HEAD} --pretty='format:%H %h %s')
git branch to-archive $HEAD
read COMMIT_SHORTID COMMIT_TITLE <<EOGIT
$(git log to-archive^..to-archive --pretty='format:%h %s')
EOGIT
popd > /dev/null
echo "Making git snapshot using commit: $COMMIT_SHORTID $COMMIT_TITLE"
DIRNAME="$NAME-git$COMMIT_SHORTID"
git archive --remote="$WORKDIR" --format=tar --prefix="$DIRNAME/" "$COMMIT_ID" | xz -9 > "$DIRNAME.tar.xz"
git archive --remote="$WORKDIR" --format=tar --prefix="$DIRNAME/" to-archive | xz -9 > "$DIRNAME.tar.xz"
echo "Written $DIRNAME.tar.xz"