diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
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.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0303-robustness.sh20
1 file changed, 20 insertions, 0 deletions
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