Make verify-commits.sh test that merges are clean
This commit is contained in:
parent
7be9a9a570
commit
577f11141c
1 changed files with 27 additions and 5 deletions
|
@ -35,6 +35,8 @@ NO_SHA1=1
|
||||||
PREV_COMMIT=""
|
PREV_COMMIT=""
|
||||||
INITIAL_COMMIT="${CURRENT_COMMIT}"
|
INITIAL_COMMIT="${CURRENT_COMMIT}"
|
||||||
|
|
||||||
|
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
if [ "$CURRENT_COMMIT" = $VERIFIED_ROOT ]; then
|
if [ "$CURRENT_COMMIT" = $VERIFIED_ROOT ]; then
|
||||||
echo "There is a valid path from \"$INITIAL_COMMIT\" to $VERIFIED_ROOT where all commits are signed!"
|
echo "There is a valid path from \"$INITIAL_COMMIT\" to $VERIFIED_ROOT where all commits are signed!"
|
||||||
|
@ -123,9 +125,29 @@ while true; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PARENTS=$(git show -s --format=format:%P "$CURRENT_COMMIT")
|
PARENTS=$(git show -s --format=format:%P "$CURRENT_COMMIT")
|
||||||
for PARENT in $PARENTS; do
|
PARENT1=${PARENTS%% *}
|
||||||
PREV_COMMIT="$CURRENT_COMMIT"
|
PARENT2=""
|
||||||
CURRENT_COMMIT="$PARENT"
|
if [ "x$PARENT1" != "x$PARENTS" ]; then
|
||||||
break
|
PARENTX=${PARENTS#* }
|
||||||
done
|
PARENT2=${PARENTX%% *}
|
||||||
|
if [ "x$PARENT2" != "x$PARENTX" ]; then
|
||||||
|
echo "Commit $CURRENT_COMMIT is an octopus merge" > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "x$PARENT2" != "x" ]; then
|
||||||
|
CURRENT_TREE="$(git show --format="%T" "$CURRENT_COMMIT")"
|
||||||
|
git checkout --force --quiet "$PARENT1"
|
||||||
|
git merge --no-ff --quiet "$PARENT2" >/dev/null
|
||||||
|
RECREATED_TREE="$(git show --format="%T" HEAD)"
|
||||||
|
if [ "$CURRENT_TREE" != "$RECREATED_TREE" ]; then
|
||||||
|
echo "Merge commit $CURRENT_COMMIT is not clean" > /dev/stderr
|
||||||
|
git diff "$CURRENT_COMMIT"
|
||||||
|
git checkout --force --quiet "$BRANCH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git checkout --force --quiet "$BRANCH"
|
||||||
|
fi
|
||||||
|
PREV_COMMIT="$CURRENT_COMMIT"
|
||||||
|
CURRENT_COMMIT="$PARENT1"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue