Skip to content

Commit

Permalink
fetch: release pack files before garbage-collecting
Browse files Browse the repository at this point in the history
Before auto-gc'ing, we need to make sure that the pack files are
released in case they need to be repacked and garbage-collected.

This fixes #500

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
dscho committed Jan 28, 2016
1 parent 2dad48b commit 59fd7b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
list.strdup_strings = 1;
string_list_clear(&list, 0);

close_all_packs();

argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
if (verbosity < 0)
argv_array_push(&argv_gc_auto, "--quiet");
Expand Down
13 changes: 13 additions & 0 deletions t/t5510-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -708,4 +708,17 @@ test_expect_success 'fetching a one-level ref works' '
)
'

test_expect_success 'fetching with auto-gc does not lock up' '
write_script askyesno <<-\EOF &&
echo "$*" &&
false
EOF
git clone "file://$D" auto-gc &&
test_commit test2 &&
cd auto-gc &&
git config gc.autoPackLimit 1 &&
GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 &&
! grep "Should I try again" fetch.out
'

test_done

0 comments on commit 59fd7b2

Please sign in to comment.