From: Junio C Hamano Date: Mon, 9 Sep 2013 21:27:11 +0000 (-0700) Subject: Merge branch 'ms/fetch-prune-configuration' X-Git-Tag: v1.8.5-rc0~174 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a5e10f8bc1db418fc806abb7574bb1e468948d19 Merge branch 'ms/fetch-prune-configuration' 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 --- a5e10f8bc1db418fc806abb7574bb1e468948d19 diff --cc builtin/fetch.c index 99afed03d4,08ab948022..5936539552 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@@ -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;