diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-24 16:39:15 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-24 16:39:15 -0700 |
| commit | e5ff701d4ca9cb8a472f946846504d9e972c6262 (patch) | |
| tree | 9ee7ef8855284be68f30a899adbfd4e78b48e9c3 /t/t5324-split-commit-graph.sh | |
| parent | 2c4aa7ad742c2f180aa7be248797d551707548a4 (diff) | |
| parent | 8981dca8bc717d7656f28fc375b513b91b365360 (diff) | |
| download | git-e5ff701d4ca9cb8a472f946846504d9e972c6262.tar.xz | |
Merge branch 'tb/commit-graph-use-tempfile'
"git update-server-info" and "git commit-graph --write" have been
updated to use the tempfile API to avoid leaving cruft after
failing.
* tb/commit-graph-use-tempfile:
server-info.c: remove temporary info files on exit
commit-graph.c: remove temporary graph layers on exit
Diffstat (limited to 't/t5324-split-commit-graph.sh')
| -rwxr-xr-x | t/t5324-split-commit-graph.sh | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh index 281266f788..77e91547ea 100755 --- a/t/t5324-split-commit-graph.sh +++ b/t/t5324-split-commit-graph.sh @@ -13,7 +13,8 @@ test_expect_success 'setup repo' ' git init && git config core.commitGraph true && git config gc.writeCommitGraph false && - infodir=".git/objects/info" && + objdir=".git/objects" && + infodir="$objdir/info" && graphdir="$infodir/commit-graphs" && test_oid_cache <<-EOM shallow sha1:2132 @@ -718,4 +719,27 @@ test_expect_success 'write generation data chunk when commit-graph chain is repl ) ' +test_expect_success 'temporary graph layer is discarded upon failure' ' + git init layer-discard && + ( + cd layer-discard && + + test_commit A && + test_commit B && + + # Intentionally remove commit "A" from the object store + # so that the commit-graph machinery fails to parse the + # parents of "B". + # + # This takes place after the commit-graph machinery has + # initialized a new temporary file to store the contents + # of the new graph layer, so will allow us to ensure + # that the temporary file is discarded upon failure. + rm $objdir/$(test_oid_to_path $(git rev-parse HEAD^)) && + + test_must_fail git commit-graph write --reachable --split && + test_dir_is_empty $graphdir + ) +' + test_done |
