From b03c055330bfc06472c6e2a28bb2ea12ca6fb0a1 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:14 -1000 Subject: Pass over a notes ref that names no tree A pusher can point refs/notes/commits or a signature notes ref at any object, and git dies loading one that is no tree, which ended every page of the repository, the dumb transport included. Such a ref now counts as absent. --- tests/t0303-robustness.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 3cd49ed..b53a38d 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -835,4 +835,24 @@ test_expect_success 'odd dates and zones in pushed objects render' ' grep "1970-01-01" tmp ' +# A notes ref a pusher pointed at something other than a tree made git die on +# loading it, which took every page of the repository down with it. +test_expect_success 'a notes ref that names no tree is passed over' ' + blob=$(echo not-a-tree | git -C repos/dates hash-object -w --stdin) && + git -C repos/dates update-ref refs/notes/commits $blob && + git -C repos/dates update-ref refs/notes/signatures/tar $blob && + { + echo "snapshots=tar" && + cat datesrc + } >notesrc && + for q in "url=dates/" "url=dates/log/" "url=dates/refs/" "url=dates/tree/" \ + "url=dates/snapshot/dates-base.tar.asc" + do + CGIT_CONFIG="$PWD/notesrc" QUERY_STRING="$q" cgit >tmp 2>err && + ! grep "Unable to complete" tmp && + ! grep "notes tree" err || return 1 + done && + grep "^Status: 404" tmp +' + test_done -- cgit