Skip to content

Commit 86d3deb

Browse files
committed
Add a rebase check for the signoff script
Signed-off-by: Ben Johnson <[email protected]>
1 parent f6abfc3 commit 86d3deb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/signoff.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
# Signs all previous commits with a DCO signoff as described in the
88
# CONTRIBUTING.md document.
99

10+
_current_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
11+
hash1=$(git show-ref --heads -s master)
12+
hash2=$(git merge-base master $_current_branch)
13+
14+
if [ "${hash1}" != "${hash2}" ]; then
15+
echo "You branch is not rebased with master. Please rebase first:"
16+
echo ""
17+
echo " git rebase master"
18+
exit 1
19+
fi
1020

1121
echo "We found the following commits since master:"
1222
echo ""
@@ -29,7 +39,6 @@ echo ""
2939

3040
_signoff="sign: $(git config --get user.name) <$(git config --get user.email)>"
3141
_commit_count=$(git rev-list --count --no-merges master..)
32-
_current_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
3342

3443
git config trailer.sign.key "Signed-off-by"
3544
git filter-branch -f --msg-filter \

0 commit comments

Comments
 (0)