Latest review note
This commit is contained in:
@@ -49,4 +49,23 @@ 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"
|
||||
|
||||
echo "ok: show/write"
|
||||
# latest finds the note by branch, even from a newer unreviewed tip
|
||||
echo three > c.txt && git add c.txt && git commit -qm three
|
||||
"$rn" latest main | grep -q '^verdict: approve$' || fail "latest should find the round 1 note"
|
||||
|
||||
# a note for another branch must not leak into the result
|
||||
sed -e 's/^branch: main/branch: other/' -e 's/^round: 1/round: 9/' "$tmp/note1b" > "$tmp/other"
|
||||
"$rn" write "$tmp/other"
|
||||
"$rn" latest main | grep -q '^verdict: approve$' || fail "latest should ignore other branches"
|
||||
|
||||
# round 2 on the new tip wins and carries previous (replaces the
|
||||
# other-branch note on the same commit, so --force)
|
||||
PREV=$(git rev-parse HEAD~1)
|
||||
sed -e 's/^round: 1/round: 2/' -e "s/^previous: none/previous: $PREV/" "$tmp/note1b" > "$tmp/note2"
|
||||
"$rn" write "$tmp/note2" --force
|
||||
"$rn" latest main | grep -q '^round: 2$' || fail "latest should pick the highest round"
|
||||
"$rn" latest main | grep -q "^previous: $PREV$" || fail "round 2 should carry previous"
|
||||
|
||||
if "$rn" latest nosuch >/dev/null 2>&1; then fail "latest should exit 1 for an unknown branch"; fi
|
||||
|
||||
echo "ok: show/write/latest"
|
||||
|
||||
Reference in New Issue
Block a user