]> git.hungrycats.org Git - linux/commitdiff
scripts/export.sh: name a public base-commit, or none
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 6 Nov 2026 07:27:11 +0000 (02:27 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 6 Nov 2026 07:27:11 +0000 (02:27 -0500)
The lane base is a local copy of kdave's "=== misc-next on b-for-next ==="
marker, so the base-commit line in the mails named a commit no reviewer
can fetch.  Name instead a commit on a public remote-tracking branch
(kdave, btrfs, linus; fetched first) with the same tree as the lane base,
and send without a base-commit line when there is none.  PUBBASE=
overrides the search.  The verify step checks every base-commit line.

Dry runs against misc-next/testing 9457797a25d7: no tree match (kdave's
misc-next has moved on), 21 series without base-commit, verified;
PUBBASE=kdave/misc-next: every line names ee901676f63d, verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/export.sh

index a98add91219a78848e5827aef4ba43741056144c..ec00004d0161a22e39b30c5c9451efce785414c6 100755 (executable)
@@ -35,6 +35,9 @@
 #   PFX      ref prefix of the topic branches (default
 #            refs/heads/misc-next/topics/)
 #   EXCLUDE  the exclusion list (default scripts/exclude.txt)
+#   PUBBASE  the base-commit the mails name (default: searched, below;
+#            set it empty to send without a base-commit line)
+#   PUBREMOTES  remotes searched for it (default "kdave btrfs linus")
 set -e -o pipefail
 HERE=$(cd "$(dirname "$0")/.." && pwd)
 OUT=${OUT:-$HERE}
@@ -46,6 +49,21 @@ MARK='DO[-_ ]?NOT[-_ ]?UPSTREAM|dropp?(ed)? before upstream'
 cd "$SRC"
 B=$(git rev-parse "$TESTING^1")
 TESTING_SHA=$(git rev-parse "$TESTING")
+
+# --- the base-commit the mails name.  The lane base is a local copy of
+# kdave's "=== misc-next on b-for-next ===" marker, so no reviewer can
+# fetch its hash.  Name instead a commit on a public remote-tracking branch
+# with the same tree; if there is none, the mails carry no base-commit line
+# (prerequisite-patch-id lines of stacked series stay).  Fetch first.
+PUBREMOTES=${PUBREMOTES:-kdave btrfs linus}
+if [ -z "${PUBBASE+x}" ]; then
+       btree=$(git rev-parse "$B^{tree}")
+       pubrefs=$(for r in $PUBREMOTES; do git for-each-ref --format='%(refname)' "refs/remotes/$r/"; done)
+       PUBBASE=
+       [ -z "$pubrefs" ] || PUBBASE=$(git log --format='%H %T' --since=120.days $pubrefs |
+               awk -v t="$btree" '$2 == t { print $1; exit }')
+fi
+[ -z "$PUBBASE" ] || PUBBASE=$(git rev-parse --verify "$PUBBASE^{commit}")
 TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT
 die() { echo "STOP: $*" >&2; exit 1; }
 
@@ -254,6 +272,11 @@ for f in sys.argv[1:]:
     if len(out) != len(lines):
         open(f, 'w').write('\n'.join(out))
 PY
+       if [ -n "$PUBBASE" ]; then
+               sed -i "s/^base-commit: $B\$/base-commit: $PUBBASE/" "$d"/[0-9][0-9][0-9][0-9]-*.patch
+       else
+               sed -i "/^base-commit: $B\$/d" "$d"/[0-9][0-9][0-9][0-9]-*.patch
+       fi
        echo "$t $n $(git rev-parse --short=12 "$PFX$t")${LANEPARENT[$t]:+ on ${LANEPARENT[$t]}}"
 done
 
@@ -293,6 +316,9 @@ left=$(for t in "${exported[@]}"; do for f in "$OUT"/topics/$t/[0-9]*.patch; do
        sed -n '/^$/q;p' "$f" | grep -q '^From: .*<ce3g8jdj@umail\.furryterror\.org>' || continue
        sed -n '/^---$/q;/^[Aa]ssisted-by:/{s|^|'"$f"': |;p}' "$f"; done; done)
 [ -z "$left" ] || die "verify: Assisted-by left in Zygo's changelogs: $left"
+badbase=$(for t in "${exported[@]}"; do grep -H '^base-commit:' "$OUT"/topics/$t/[0-9]*.patch 2>/dev/null; done |
+       grep -v ":base-commit: ${PUBBASE:-NONE}\$" || true)
+[ -z "$badbase" ] || die "verify: unexpected base-commit lines: $badbase"
 GIT_INDEX_FILE=$idx git read-tree "$acc"
 if [ -s "$OUT/fixups/post-merge.patch" ]; then
        GIT_INDEX_FILE=$idx git apply --cached "$OUT/fixups/post-merge.patch"
@@ -300,4 +326,4 @@ fi
 [ "$(GIT_INDEX_FILE=$idx git write-tree)" = "$(git rev-parse "$target^{tree}")" ] || die "verify: post-merge"
 echo "fixup target: tree $(git rev-parse "$target^{tree}") (testing without the dropped commits${RESOLVED:+; ${#RESOLVED[@]} revert(s) by stored resolution})"
 echo "fixup: $(git diff --shortstat "$acc" "$target" | sed 's/^ //;s/^$/empty/')"
-echo "verified; base $(git rev-parse --short=12 "$B") testing $(git rev-parse --short=12 "$TESTING") zb64 $(git rev-parse --short=12 zygo-misc-next-zb64)"
+echo "verified; base $(git rev-parse --short=12 "$B") (mails: $([ -n "$PUBBASE" ] && echo "base-commit $(git rev-parse --short=12 "$PUBBASE")" || echo "no base-commit")) testing $(git rev-parse --short=12 "$TESTING") zb64 $(git rev-parse --short=12 zygo-misc-next-zb64)"