fetch, remote: properly convey --no-prune options to subprocesses
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>
Michael Haggerty committed
Oct 30, 2013 at 06:33 UTC
90765fa3e01658ac2fb75a4eb740cee7dad4a2dc
2 files changed
+5
-5
builtin/fetch.c
+2
-2
@@ -936,8 +936,8 @@ static void add_options_to_argv(struct argv_array *argv)
936
{
937
if (dry_run)
938
argv_array_push(argv, "--dry-run");
939
- if (prune > 0)
940
- argv_array_push(argv, "--prune");
939
+ if (prune != -1)
940
+ argv_array_push(argv, prune ? "--prune" : "--no-prune");
941
if (update_head_ok)
942
argv_array_push(argv, "--update-head-ok");
943
if (force)
builtin/remote.c
+3
-3
@@ -1371,7 +1371,7 @@ static int get_remote_default(const char *key, const char *value, void *priv)
1371
1372
static int update(int argc, const char **argv)
1373
{
1374
- int i, prune = 0;
1374
+ int i, prune = -1;
1375
struct option options[] = {
1376
OPT_BOOL('p', "prune", &prune,
1377
N_("prune remotes after fetching")),
@@ -1386,8 +1386,8 @@ static int update(int argc, const char **argv)
1386
1387
argv_array_push(&fetch_argv, "fetch");
1388
1389
- if (prune)
1390
- argv_array_push(&fetch_argv, "--prune");
1389
+ if (prune != -1)
1390
+ argv_array_push(&fetch_argv, prune ? "--prune" : "--no-prune");
1391
if (verbose)
1392
argv_array_push(&fetch_argv, "-v");
1393
argv_array_push(&fetch_argv, "--multiple");