From fcb862f1bee8a6ce923224dcd60af7ac4f1b6351 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 14:55:45 -1000 Subject: Check that a later push adds a graph layer The check was a negated test_cmp, which also passes when either file is missing, and a changed chain does not prove the new layer was written. The chain's last line now has to name a graph file that exists and was not in the chain before the push. --- tests/t0507-hooks.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/t0507-hooks.sh') diff --git a/tests/t0507-hooks.sh b/tests/t0507-hooks.sh index 275a12b..23a7a6d 100755 --- a/tests/t0507-hooks.sh +++ b/tests/t0507-hooks.sh @@ -347,13 +347,19 @@ do test_grep ! "^-r-------" modes ' + # The newest layer is the last line of the chain, and it has to be one + # the push itself added. test_expect_success "a later push moves the graph on under $shell" ' - cat graph-$shell.git/objects/info/commit-graphs/commit-graph-chain >chain-$shell && + graphs=graph-$shell.git/objects/info/commit-graphs && + cp $graphs/commit-graph-chain chain-$shell && test_commit -C work graph-$shell && git -C work push -q ../graph-$shell.git HEAD:main && (cd graph-$shell.git && $shell "$HOOK_DIRECTORY/post-receive.commit-graph" 2>../err) && test_must_be_empty err && - ! test_cmp chain-$shell graph-$shell.git/objects/info/commit-graphs/commit-graph-chain && + newest=$(tail -n 1 $graphs/commit-graph-chain) && + test -n "$newest" && + test_path_is_file $graphs/graph-$newest.graph && + test_grep ! "^$newest\$" chain-$shell && git -C graph-$shell.git commit-graph verify ' done -- cgit 2.12.1