X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=t%2Ft7700-repack.sh;h=c2f66ff1703c35d5f5b92285e31e8df157e51642;hb=48c250a121a425a1860226b6a7061aecfbab5246;hp=87c9b0e121db6c8ab7074e6c4968cd06d37851fe;hpb=ee969693c5e77e1b5ebda45bead569806d31b379;p=git.git diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index 87c9b0e12..c2f66ff17 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -8,6 +8,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' ' echo content1 > file1 && echo content2 > file2 && git add . && + test_tick && git commit -m initial_commit && # Create two packs # The first pack will contain all of the objects except one @@ -40,6 +41,7 @@ test_expect_success 'loose objects in alternate ODB are not repacked' ' echo content3 > file3 && objsha1=$(GIT_OBJECT_DIRECTORY=alt_objects git hash-object -w file3) && git add file3 && + test_tick && git commit -m commit_file3 && git repack -a -d -l && git prune-packed && @@ -73,6 +75,7 @@ test_expect_success 'packed obs in alt ODB are repacked when local repo has pack rm -f .git/objects/pack/* && echo new_content >> file1 && git add file1 && + test_tick && git commit -m more_content && git repack && git repack -a -d && @@ -118,8 +121,8 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' ' mv .git/objects/pack/* alt_objects/pack/ && csha1=$(git rev-parse HEAD^{commit}) && git reset --hard HEAD^ && - sleep 1 && - git reflog expire --expire=now --expire-unreachable=now --all && + test_tick && + git reflog expire --expire=$test_tick --expire-unreachable=$test_tick --all && # The pack-objects call on the next line is equivalent to # git repack -A -d without the call to prune-packed git pack-objects --honor-pack-keep --non-empty --all --reflog \ @@ -149,5 +152,17 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar test_must_fail git show $csha1 ' +test_expect_success 'objects made unreachable by grafts only are kept' ' + test_tick && + git commit --allow-empty -m "commit 4" && + H0=$(git rev-parse HEAD) && + H1=$(git rev-parse HEAD^) && + H2=$(git rev-parse HEAD^^) && + echo "$H0 $H2" > .git/info/grafts && + git reflog expire --expire=$test_tick --expire-unreachable=$test_tick --all && + git repack -a -d && + git cat-file -t $H1 + ' + test_done