Skip to content

Commit

Permalink
Merge branch 'js/close-packs-before-gc' into HEAD
Browse files Browse the repository at this point in the history
This fixes #500

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Jan 28, 2016
2 parents 5c01635 + 13ed4f1 commit 2a3188b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions builtin/am.c
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,7 @@ static void am_run(struct am_state *state, int resume)
*/
if (!state->rebasing) {
am_destroy(state);
close_all_packs();
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
}
}
Expand Down
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
1 change: 1 addition & 0 deletions builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ static void finish(struct commit *head_commit,
* We ignore errors in 'gc --auto', since the
* user should see them.
*/
close_all_packs();
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
}
}
Expand Down
1 change: 1 addition & 0 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
"gc", "--auto", "--quiet", NULL,
};
int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR;
close_all_packs();
run_command_v_opt(argv_gc_auto, opt);
}
if (auto_update_server_info)
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 2a3188b

Please sign in to comment.