Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Check the commit-graph hook with a git too old
The header says a git too old for the options leaves the graph as it
was and the hook stays silent, but every run had a git that could
write it.
| -rwxr-xr-x | tests/t0507-hooks.sh | 24 |
1 file changed, 24 insertions, 0 deletions
diff --git a/tests/t0507-hooks.sh b/tests/t0507-hooks.sh index b695e03..0a869f9 100755 --- a/tests/t0507-hooks.sh +++ b/tests/t0507-hooks.sh @@ -417,6 +417,30 @@ do test_grep ! "^$newest\$" chain-$shell && git -C graph-$shell.git commit-graph verify ' + + test_expect_success "a git too old to write the graph leaves it quietly under $shell" ' + mkdir -p old-git && + write_script old-git/git <<-\EOF && + if test "$1" = commit-graph + then + echo "error: unknown option" >&2 + exit 129 + fi + exec "$REAL_GIT" "$@" + EOF + real_git=$(command -v git) && + shim="$PWD/old-git" && + graphs=graph-$shell.git/objects/info/commit-graphs && + cp $graphs/commit-graph-chain old-chain-$shell && + test_commit -C work old-$shell && + git -C work push -q ../graph-$shell.git HEAD:main && + ( + cd graph-$shell.git && + REAL_GIT=$real_git PATH="$shim:$PATH" $run "$HOOK_DIRECTORY/post-receive.commit-graph" 2>../err + ) && + test_must_be_empty err && + test_cmp old-chain-$shell $graphs/commit-graph-chain + ' done test_done |
