mirror of
https://git.dn42.dev/dn42/registry.git
synced 2025-07-20 09:26:59 +08:00
re-order squash-my-commit script to count commits before rebasing
This commit is contained in:
parent
bb3e7cee37
commit
015536eef6
1 changed files with 18 additions and 25 deletions
|
@ -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
|
# find number of local commits
|
||||||
count=$(git rev-list --count HEAD ^dn42registry/master)
|
count=$(git rev-list --count HEAD ^dn42registry/master)
|
||||||
|
|
||||||
|
@ -151,6 +126,24 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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 ...'
|
echo 'Squashing $count commits ...'
|
||||||
|
|
||||||
# construct a new comment based on previous commits
|
# construct a new comment based on previous commits
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue