Packaging: Try to fix git-export-release.sh.

Attempting to release 3.5.0 failed with

No local changes to save
Creating ./wireshark-3.5.0.tar.xz
fatal: not a valid object name: stash@{0}

Use CI_COMMIT_SHA for our export commit if it exists.
This commit is contained in:
Gerald Combs 2021-08-27 10:55:30 -07:00
parent b7ff41703e
commit e7296d5208
1 changed files with 9 additions and 6 deletions

View File

@ -44,21 +44,24 @@ if [ -f "${DESTDIR}/wireshark-$VERSION.tar.xz" ] ; then
exit 0
fi
STASH_POP=false
XZ_OPTS=
COMMIT="HEAD"
if ! git diff-index --quiet HEAD ; then
if [ -n "$CI_COMMIT_SHA" ] ; then
COMMIT=$CI_COMMIT_SHA
fi
STASH_POP=false
if ! git diff-index "$COMMIT" ; then
git stash --keep-index
COMMIT="stash@{0}"
STASH_POP=true
fi
echo "Creating ${DESTDIR}/wireshark-$VERSION.tar.xz"
echo "Creating ${DESTDIR}/wireshark-$VERSION.tar.xz from $COMMIT"
XZ_OPTS=
echo . | xz --threads=0 > /dev/null 2>&1 && XZ_OPTS=--threads=0
git archive --prefix="wireshark-${VERSION}/" ${COMMIT} | xz $XZ_OPTS > "${DESTDIR}/wireshark-${VERSION}.tar.xz"
git archive --prefix="wireshark-${VERSION}/" "$COMMIT" | xz $XZ_OPTS > "${DESTDIR}/wireshark-${VERSION}.tar.xz"
if $STASH_POP ; then
git stash pop