Merge pull request 'Update squash-my-commits script' (#1060) from burble-20210819/fix-squash-script into master

Reviewed-on: https://git.dn42.dev/dn42/registry/pulls/1060
Reviewed-by: schema-checker <schema-checker@noreply.dn42.us>
Reviewed-by: jrb0001 <jrb0001@noreply.dn42.us>
This commit is contained in:
Simon Marsh 2021-08-19 17:26:50 +00:00
commit 1d41822748

View file

@ -110,8 +110,26 @@ fi
##########################################################################
# ensure the local branch is up to date
echo "Fetching dn42registry 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
# find number of local commits
count=$(git rev-list --count HEAD ^dn42registry/master)
if [ $? -ne 0 ]
then
echo "ERROR: Failed to find the number of local commits"
echo "Please report this as a bug to the registry maintainters"
exit 1
fi
# if there are less then 2 local commits, there's nothing to do
if [ "$count" -lt 2 ]
@ -126,22 +144,11 @@ 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
echo 'Rebasing local changes against the registry master'
git rebase dn42registry/master
echo 'Squashing $count commits ...'