diff options
-rw-r--r-- | reachable.c | 13 | ||||
-rwxr-xr-x | t/t5304-prune.sh | 16 | ||||
-rwxr-xr-x | t/t6501-freshen-objects.sh | 22 |
3 files changed, 36 insertions, 15 deletions
diff --git a/reachable.c b/reachable.c index 77a60c70a5..a088717eb5 100644 --- a/reachable.c +++ b/reachable.c @@ -227,17 +227,12 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog, if (bitmap_git) { traverse_bitmap_commit_list(bitmap_git, revs, mark_object_seen); free_bitmap_index(bitmap_git); - return; + } else { + if (prepare_revision_walk(revs)) + die("revision walk setup failed"); + traverse_commit_list(revs, mark_commit, mark_object, &cp); } - /* - * Set up the revision walk - this will move all commits - * from the pending list to the commit walking list. - */ - if (prepare_revision_walk(revs)) - die("revision walk setup failed"); - traverse_commit_list(revs, mark_commit, mark_object, &cp); - if (mark_recent) { revs->ignore_missing_links = 1; if (add_unseen_recent_objects_to_traversal(revs, mark_recent)) diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index b447ce56a9..3475b06aeb 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -352,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 diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh index 75210f012b..10662456ae 100755 --- a/t/t6501-freshen-objects.sh +++ b/t/t6501-freshen-objects.sh @@ -43,15 +43,25 @@ commit () { } maybe_repack () { - if test -n "$repack"; then + case "$title" in + loose) + : skip repack + ;; + repack) git repack -ad - fi + ;; + bitmap) + git repack -adb + ;; + *) + echo >&2 "unknown test type in maybe_repack" + return 1 + ;; + esac } -for repack in '' true; do - title=${repack:+repack} - title=${title:-loose} - +for title in loose repack bitmap +do test_expect_success "make repo completely empty ($title)" ' rm -rf .git && git init |