mirror of
https://git.dn42.dev/dn42/registry.git
synced 2025-07-19 08:56: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,8 +110,21 @@ fi
|
|||
|
||||
##########################################################################
|
||||
|
||||
if [ "$verify_only" -ne 1 ]
|
||||
# find number of local commits
|
||||
count=$(git rev-list --count HEAD ^dn42registry/master)
|
||||
|
||||
# if there are less then 2 local commits, there's nothing to do
|
||||
if [ "$count" -lt 2 ]
|
||||
then
|
||||
echo "$count local commits found, no squash is required"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$verify_only" -eq 1 ]
|
||||
then
|
||||
echo "$count local commits found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ensure the local branch is up to date
|
||||
echo 'Rebasing local changes against the registry master'
|
||||
|
@ -128,28 +141,8 @@ then
|
|||
# fail on errors from here onwards
|
||||
set -e
|
||||
|
||||
# do the rebase thing
|
||||
git rebase dn42registry/master
|
||||
else
|
||||
set -e
|
||||
fi
|
||||
|
||||
##########################################################################
|
||||
|
||||
# find number of local commits
|
||||
count=$(git rev-list --count HEAD ^dn42registry/master)
|
||||
|
||||
# if there are less then 2 local commits, there's nothing to do
|
||||
if [ "$count" -lt 2 ]
|
||||
then
|
||||
echo "$count local commits found, no squash is required"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$verify_only" -eq 1 ]
|
||||
then
|
||||
echo "$count local commits found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Squashing $count commits ...'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue