From 308d89f8e0eebe22bdf234bc3abdae6b26ef42c8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:17:27 -0700 Subject: Free the log's tip when its walk fails Every exit now goes through one label, which also clears the walk arguments that the normal end used to leave allocated. --- tests/t0103-log.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/t0103-log.sh') diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh index 4306d8c..98b4e0b 100755 --- a/tests/t0103-log.sh +++ b/tests/t0103-log.sh @@ -132,4 +132,23 @@ test_expect_success 'a search for brackets matches them literally' ' grep "fix \\[brackets\\] in docs" tmp ' +# A range is walked in full before the first row, so a missing parent fails +# the walk while the page can still answer with an error of its own. +test_expect_success 'a walk that cannot start answers one error page' ' + git clone -q repos/foo gap && + old=$(git -C gap rev-parse HEAD~4) && + parent=$(git -C gap rev-parse HEAD~2) && + rm gap/.git/objects/$(echo $parent | cut -c1-2)/$(echo $parent | cut -c3-) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "repo.url=gap" && + echo "repo.path=$PWD/gap/.git" + } >gaprc && + CGIT_CONFIG="$PWD/gaprc" QUERY_STRING="url=gap/log/&qt=range&q=$old..master" cgit >tmp 2>err && + test $(grep -c "^Status:" tmp) = 1 && + grep "^Status: 500" tmp && + grep "Unable to read the history" tmp +' + test_done -- cgit