Skip to content

Commit 2a3188b

Browse files
committed
Merge branch 'js/close-packs-before-gc' into HEAD
This fixes #500 Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 5c01635 + 13ed4f1 commit 2a3188b

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed

builtin/am.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,7 @@ static void am_run(struct am_state *state, int resume)
19391939
*/
19401940
if (!state->rebasing) {
19411941
am_destroy(state);
1942+
close_all_packs();
19421943
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
19431944
}
19441945
}

builtin/fetch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
12211221
list.strdup_strings = 1;
12221222
string_list_clear(&list, 0);
12231223

1224+
close_all_packs();
1225+
12241226
argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
12251227
if (verbosity < 0)
12261228
argv_array_push(&argv_gc_auto, "--quiet");

builtin/merge.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ static void finish(struct commit *head_commit,
404404
* We ignore errors in 'gc --auto', since the
405405
* user should see them.
406406
*/
407+
close_all_packs();
407408
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
408409
}
409410
}

builtin/receive-pack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
17961796
"gc", "--auto", "--quiet", NULL,
17971797
};
17981798
int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR;
1799+
close_all_packs();
17991800
run_command_v_opt(argv_gc_auto, opt);
18001801
}
18011802
if (auto_update_server_info)

t/t5510-fetch.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,4 +708,17 @@ test_expect_success 'fetching a one-level ref works' '
708708
)
709709
'
710710

711+
test_expect_success 'fetching with auto-gc does not lock up' '
712+
write_script askyesno <<-\EOF &&
713+
echo "$*" &&
714+
false
715+
EOF
716+
git clone "file://$D" auto-gc &&
717+
test_commit test2 &&
718+
cd auto-gc &&
719+
git config gc.autoPackLimit 1 &&
720+
GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 &&
721+
! grep "Should I try again" fetch.out
722+
'
723+
711724
test_done

0 commit comments

Comments
 (0)