Merge pull request 're-order squash-my-commit script to count commits before rebasing' (#990) from burble-20210727/fix-smc-script into master

Reviewed-on: https://git.dn42.dev/dn42/registry/pulls/990
This commit is contained in:
Simon Marsh 2021-07-27 19:15:32 +00:00
commit a486641a52

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