Merge branch 'ms/fetch-prune-configuration'
authorJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2013 21:27:11 +0000 (14:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2013 21:27:11 +0000 (14:27 -0700)
Allow fetch.prune and remote.*.prune configuration variables to be set,
and "git fetch" to behave as if "--prune" is given.

"git fetch" that honors remote.*.prune is fine, but I wonder if we
should somehow make "git push" aware of it as well. Perhaps
remote.*.prune should not be just a boolean, but a 4-way "none",
"push", "fetch", "both"?

* ms/fetch-prune-configuration:
fetch: make --prune configurable

1  2 
Documentation/config.txt
builtin/fetch.c
remote.c
t/t5510-fetch.sh
Simple merge
diff --cc builtin/fetch.c
index 99afed03d4c95c02bc7cff8c568feb7e162439ae,08ab9480223dca2dc8999b6b9755058ffb0254bb..593653955201995227c062d3878aafc09b424940
@@@ -54,12 -58,21 +58,21 @@@ static int option_parse_recurse_submodu
        return 0;
  }
  
+ static int git_fetch_config(const char *k, const char *v, void *cb)
+ {
+       if (!strcmp(k, "fetch.prune")) {
+               fetch_prune_config = git_config_bool(k, v);
+               return 0;
+       }
+       return 0;
+ }
  static struct option builtin_fetch_options[] = {
        OPT__VERBOSITY(&verbosity),
 -      OPT_BOOLEAN(0, "all", &all,
 -                  N_("fetch from all remotes")),
 -      OPT_BOOLEAN('a', "append", &append,
 -                  N_("append to .git/FETCH_HEAD instead of overwriting")),
 +      OPT_BOOL(0, "all", &all,
 +               N_("fetch from all remotes")),
 +      OPT_BOOL('a', "append", &append,
 +               N_("append to .git/FETCH_HEAD instead of overwriting")),
        OPT_STRING(0, "upload-pack", &upload_pack, N_("path"),
                   N_("path to upload pack on remote end")),
        OPT__FORCE(&force, N_("force overwrite of local branch")),
@@@ -767,11 -749,13 +780,14 @@@ static int do_fetch(struct transport *t
                transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
        if (fetch_refs(transport, ref_map)) {
                free_refs(ref_map);
 -              return 1;
 +              retcode = 1;
 +              goto cleanup;
        }
        if (prune) {
-               /* If --tags was specified, pretend the user gave us the canonical tags refspec */
+               /*
+                * If --tags was specified, pretend that the user gave us
+                * the canonical tags refspec
+                */
                if (tags == TAGS_SET) {
                        const char *tags_str = "refs/tags/*:refs/tags/*";
                        struct refspec *tags_refspec, *refspec;
diff --cc remote.c
Simple merge
Simple merge