diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-07-17 13:28:31 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-03-15 15:29:30 -0700 |
commit | 05dd9f139d6a7e4c7cd22d8d3b57faf5be88a571 (patch) | |
tree | 68ae3bcd44ea9c6160f4826c772f6ac1e3771dd6 /t | |
parent | 2c7929b133387f563306c0550b24a4b5f674ecb6 (diff) | |
download | git-05dd9f139d6a7e4c7cd22d8d3b57faf5be88a571.tar.gz git-05dd9f139d6a7e4c7cd22d8d3b57faf5be88a571.tar.xz |
rerere: handle leftover rr-cache/$ID directory and postimage files
If by some accident there is only $GIT_DIR/rr-cache/$ID directory
existed, we wouldn't have recorded a preimage for a conflict that
is newly encountered, which would mean after a manual resolution,
we wouldn't have recorded it by storing the postimage, because the
logic used to be "if there is no rr-cache/$ID directory, then we are
the first so record the preimage". Instead, record preimage if we
do not have one.
In addition, if there is only $GIT_DIR/rr-cache/$ID/postimage
without corresponding preimage, we would have tried to call into
merge() and punted.
These would have been a situation frustratingly hard to recover
from.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t4200-rerere.sh | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index ed9c91e25..c4280110b 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -184,12 +184,27 @@ test_expect_success 'rerere updates postimage timestamp' ' ' test_expect_success 'rerere clear' ' - rm $rr/postimage && + mv $rr/postimage .git/post-saved && echo "$sha1 a1" | perl -pe "y/\012/\000/" >.git/MERGE_RR && git rerere clear && ! test -d $rr ' +test_expect_success 'leftover directory' ' + git reset --hard && + mkdir -p $rr && + test_must_fail git merge first && + test -f $rr/preimage +' + +test_expect_success 'missing preimage' ' + git reset --hard && + mkdir -p $rr && + cp .git/post-saved $rr/postimage && + test_must_fail git merge first && + test -f $rr/preimage +' + test_expect_success 'set up for garbage collection tests' ' mkdir -p $rr && echo Hello >$rr/preimage && |