re-order squash-my-commit script to count commits before rebasing

This commit is contained in:
Simon Marsh 2021-07-27 20:14:03 +01:00
parent bb3e7cee37
commit 015536eef6
No known key found for this signature in database
GPG key ID: 0FCCD13AE1CF7ED8

View file

@ -110,31 +110,6 @@ fi
##########################################################################
if [ "$verify_only" -ne 1 ]
then
# ensure the local branch is up to date
echo 'Rebasing local changes against the registry master'
git fetch dn42registry master
if [ $? -ne 0 ]
then
echo 'ERROR: Failed to fetch registry master branch'
echo 'Hint: you can use --ssh/--https to force use of ssh or https'
echo 'If all else fails, you can also set the DN42_REG_URL'
echo 'environment variable to directly specify the URL to fetch'
exit 1
fi
# fail on errors from here onwards
set -e
git rebase dn42registry/master
else
set -e
fi
##########################################################################
# find number of local commits
count=$(git rev-list --count HEAD ^dn42registry/master)
@ -151,6 +126,24 @@ then
exit 1
fi
# ensure the local branch is up to date
echo 'Rebasing local changes against the registry master'
git fetch dn42registry master
if [ $? -ne 0 ]
then
echo 'ERROR: Failed to fetch registry master branch'
echo 'Hint: you can use --ssh/--https to force use of ssh or https'
echo 'If all else fails, you can also set the DN42_REG_URL'
echo 'environment variable to directly specify the URL to fetch'
exit 1
fi
# fail on errors from here onwards
set -e
# do the rebase thing
git rebase dn42registry/master
echo 'Squashing $count commits ...'
# construct a new comment based on previous commits