Skip to content

Commit

Permalink
fetch, remote: properly convey --no-prune options to subprocesses
Browse files Browse the repository at this point in the history
If --no-prune is passed to one of the following commands:

    git fetch --all
    git fetch --multiple
    git fetch --recurse-submodules
    git remote update

then it must also be passed to the "fetch" subprocesses that those
commands use to do their work.  Otherwise there might be a fetch.prune
or remote.<name>.prune configuration setting that causes pruning to
occur, contrary to the user's express wish.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Oct 30, 2013
1 parent 8607590 commit 90765fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,8 @@ static void add_options_to_argv(struct argv_array *argv)
{
if (dry_run)
argv_array_push(argv, "--dry-run");
if (prune > 0)
argv_array_push(argv, "--prune");
if (prune != -1)
argv_array_push(argv, prune ? "--prune" : "--no-prune");
if (update_head_ok)
argv_array_push(argv, "--update-head-ok");
if (force)
Expand Down
6 changes: 3 additions & 3 deletions builtin/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ static int get_remote_default(const char *key, const char *value, void *priv)

static int update(int argc, const char **argv)
{
int i, prune = 0;
int i, prune = -1;
struct option options[] = {
OPT_BOOL('p', "prune", &prune,
N_("prune remotes after fetching")),
Expand All @@ -1386,8 +1386,8 @@ static int update(int argc, const char **argv)

argv_array_push(&fetch_argv, "fetch");

if (prune)
argv_array_push(&fetch_argv, "--prune");
if (prune != -1)
argv_array_push(&fetch_argv, prune ? "--prune" : "--no-prune");
if (verbose)
argv_array_push(&fetch_argv, "-v");
argv_array_push(&fetch_argv, "--multiple");
Expand Down

0 comments on commit 90765fa

Please sign in to comment.