From: Junio C Hamano Date: Sun, 19 Jul 2026 02:23:57 +0000 (-0700) Subject: Meta/basecheck: validate the synthetic base of topics X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ccbb5aad8aec65073894715bf8bfdd247654491b;p=thirdparty%2Fgit.git Meta/basecheck: validate the synthetic base of topics --- diff --git a/basecheck.sh b/basecheck.sh new file mode 100755 index 0000000000..6ca58bc963 --- /dev/null +++ b/basecheck.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +if test $# = 3 +then + merge=$1 base=$2 target=$3 + label=$(git log --oneline -1 "$merge") + + base0=$(git rev-parse "$base^0") && + base1=$(git rev-parse "$merge^2") && + test "$base0" = "$base1" || { + echo >&2 "BAD: stale $base in $target" + exit 2 + } + + cd ../git.one || exit 1 + if grep "$merge" :basecheck-tested-ok >/dev/null + then + exit 0 + elif grep "$merge" :basecheck-tested-ng >/dev/null + then + echo >&2 "BAD (again): $label" + exit 1 + fi + + echo >&2 "Testing $merge $target" + git reset --quiet --hard "$merge" || exit 1 + if Meta/Make -s -j32 >:basecheck-errors 2>&1 + then + echo >&2 "OK: $label" + echo "$merge" >>:basecheck-tested-ok + exit 0 + else + echo "$merge" >>:basecheck-tested-ng + cat ":basecheck-errors" + echo >&2 "BAD: $label" + exit 1 + fi + + exit 0 ;# just in case +fi + +git log --oneline --abbrev=-1 --min-parents=2 ..seen | +sed -n -e "s|^\([0-9a-f]*\) Merge branch '\(.*\)' into \(../..*\)$|\1 \2 \3|p" | +{ + exit= + while read merge base target + do + "$0" "$merge" "$base" "$target"