diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-09-24 19:30:46 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-09-24 19:30:46 +0200 |
commit | 48a81ed29795da3e4cc40d4e5ea535878e4f2d9f (patch) | |
tree | 0bbe3588f5728fa03ae0ef69dc9111ef91479a83 /t/t0090-cache-tree.sh | |
parent | Merge branch 'bp/mv-submodules-with-fsmonitor' (diff) | |
parent | reopen_tempfile(): truncate opened file (diff) | |
download | git-48a81ed29795da3e4cc40d4e5ea535878e4f2d9f.tar.xz git-48a81ed29795da3e4cc40d4e5ea535878e4f2d9f.zip |
Merge branch 'jk/reopen-tempfile-truncate'
Fix for a long-standing bug that leaves the index file corrupt when
it shrinks during a partial commit.
* jk/reopen-tempfile-truncate:
reopen_tempfile(): truncate opened file
Diffstat (limited to 't/t0090-cache-tree.sh')
-rwxr-xr-x | t/t0090-cache-tree.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 7de40141ca..94fcb4a78e 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -161,6 +161,24 @@ test_expect_success PERL 'commit --interactive gives cache-tree on partial commi test_cache_tree ' +test_expect_success PERL 'commit -p with shrinking cache-tree' ' + mkdir -p deep/subdir && + echo content >deep/subdir/file && + git add deep && + git commit -m add && + git rm -r deep && + + before=$(wc -c <.git/index) && + git commit -m delete -p && + after=$(wc -c <.git/index) && + + # double check that the index shrank + test $before -gt $after && + + # and that our index was not corrupted + git fsck +' + test_expect_success 'commit in child dir has cache-tree' ' mkdir dir && >dir/child.t && |