Review note push

This commit is contained in:
2026-10-02 14:45:17 +03:00
parent e7adb3e88b
commit 4664e71493
2 changed files with 17 additions and 1 deletions
+6
View File
@@ -75,6 +75,11 @@ cmd_latest() {
printf '%s\n' "$best" printf '%s\n' "$best"
} }
cmd_push() {
git rev-parse -q --verify "$NOTES_REF" >/dev/null || die "no review notes to push"
git push "$REMOTE" "$NOTES_REF"
}
main() { main() {
local cmd="${1:-}" local cmd="${1:-}"
if [ $# -gt 0 ]; then shift; fi if [ $# -gt 0 ]; then shift; fi
@@ -82,6 +87,7 @@ main() {
show) cmd_show "$@" ;; show) cmd_show "$@" ;;
write) cmd_write "$@" ;; write) cmd_write "$@" ;;
latest) cmd_latest "$@" ;; latest) cmd_latest "$@" ;;
push) cmd_push "$@" ;;
*) usage ;; *) usage ;;
esac esac
} }
+11 -1
View File
@@ -8,6 +8,7 @@ fail() { echo "FAIL: $*" >&2; exit 1; }
tmp=$(mktemp -d) tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT trap 'rm -rf "$tmp"' EXIT
git init -q --bare "$tmp/remote.git"
git init -q -b main "$tmp/repo" git init -q -b main "$tmp/repo"
cd "$tmp/repo" cd "$tmp/repo"
git config user.email test@example.com git config user.email test@example.com
@@ -68,4 +69,13 @@ sed -e 's/^round: 1/round: 2/' -e "s/^previous: none/previous: $PREV/" "$tmp/not
if "$rn" latest nosuch >/dev/null 2>&1; then fail "latest should exit 1 for an unknown branch"; fi if "$rn" latest nosuch >/dev/null 2>&1; then fail "latest should exit 1 for an unknown branch"; fi
echo "ok: show/write/latest" # push publishes notes to origin; a fresh clone picks them up
git remote add origin "$tmp/remote.git"
git push -q origin main
"$rn" push
git clone -q "$tmp/remote.git" "$tmp/clone"
cd "$tmp/clone"
git fetch -q origin "refs/notes/review:refs/notes/review"
"$rn" latest main | grep -q '^round: 2$' || fail "clone should see the round 2 note"
echo "ok: show/write/latest/push"