From 0e5d76901d850c66bf3ef58008740fa9dd83d417 Mon Sep 17 00:00:00 2001 From: Mats Rauhala Date: Fri, 2 Oct 2026 15:13:04 +0300 Subject: [PATCH] Bound note header parsing --- scripts/review-note | 4 ++-- scripts/review-note-test | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/review-note b/scripts/review-note index 2173272..aa3753a 100755 --- a/scripts/review-note +++ b/scripts/review-note @@ -62,9 +62,9 @@ cmd_latest() { local blob obj note br rnd best="" best_round=-1 while read -r blob obj; do note=$(git notes --ref="$NOTES_REF" show "$obj") || continue - br=$(sed -n 's/^branch: //p' <<<"$note") + br=$(sed -n '/^$/q; s/^branch: //p' <<<"$note") [ "$br" = "$branch" ] || continue - rnd=$(sed -n 's/^round: //p' <<<"$note") + rnd=$(sed -n '/^$/q; s/^round: //p' <<<"$note") [[ "$rnd" =~ ^[0-9]+$ ]] || continue if [ "$rnd" -gt "$best_round" ]; then best_round=$rnd diff --git a/scripts/review-note-test b/scripts/review-note-test index ee7369b..0f8ce0f 100755 --- a/scripts/review-note-test +++ b/scripts/review-note-test @@ -49,6 +49,7 @@ if "$rn" write "$note" >/dev/null 2>&1; then fail "write should refuse an existi sed 's/^verdict: request-changes/verdict: approve/' "$note" > "$tmp/note1b" "$rn" write "$tmp/note1b" --force "$rn" show | grep -q '^verdict: approve$' || fail "show should print the replaced note" +"$rn" show | diff -u "$tmp/note1b" - || fail "show should print the note verbatim" # latest finds the note by branch, even from a newer unreviewed tip echo three > c.txt && git add c.txt && git commit -qm three