diff options
Diffstat (limited to 't/t5304-prune.sh')
-rwxr-xr-x | t/t5304-prune.sh | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index df60f18fb8..3475b06aeb 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -4,6 +4,9 @@ # test_description='prune' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh day=$((60*60*24)) @@ -119,7 +122,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' ' test_expect_success 'prune: prune former HEAD after checking out branch' ' head_oid=$(git rev-parse HEAD) && - git checkout --quiet master && + git checkout --quiet main && git prune -v >prune_actual && grep "$head_oid" prune_actual @@ -349,4 +352,20 @@ test_expect_success 'trivial prune with bitmaps enabled' ' test_must_fail git cat-file -e $blob ' +test_expect_success 'old reachable-from-recent retained with bitmaps' ' + git repack -adb && + to_drop=$(echo bitmap-from-recent-1 | git hash-object -w --stdin) && + test-tool chmtime -86400 .git/objects/$(test_oid_to_path $to_drop) && + to_save=$(echo bitmap-from-recent-2 | git hash-object -w --stdin) && + test-tool chmtime -86400 .git/objects/$(test_oid_to_path $to_save) && + tree=$(printf "100644 blob $to_save\tfile\n" | git mktree) && + test-tool chmtime -86400 .git/objects/$(test_oid_to_path $tree) && + commit=$(echo foo | git commit-tree $tree) && + git prune --expire=12.hours.ago && + git cat-file -e $commit && + git cat-file -e $tree && + git cat-file -e $to_save && + test_must_fail git cat-file -e $to_drop +' + test_done |