Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
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.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0507-hooks.sh | 10 |
1 file changed, 8 insertions, 2 deletions
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 |
