Bound note header parsing
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user