push: allow --follow-tags to be set by config push.followTags

Signed-off-by: Dave Olszewski <cxreg@pobox.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dave Olszewski committed Feb 16, 2015 at 01:16 UTC a8bc269f11b34e60f5fdbd8e831a654dd6b6b67e
4 files changed +21 -1
Documentation/config.txt
+6
@@ -2079,6 +2079,12 @@ new default).
2079
2080 --
2081
2082 +push.followTags::
2083 + If set to true enable '--follow-tags' option by default. You
2084 + may override this configuration at time of push by specifying
2085 + '--no-follow-tags'.
2086 +
2087 +
2088 rebase.stat::
2089 Whether to show a diffstat of what changed upstream since the last
2090 rebase. False by default.
Documentation/git-push.txt
+4 -1
@@ -128,7 +128,10 @@ already exists on the remote side.
128 Push all the refs that would be pushed without this option,
129 and also push annotated tags in `refs/tags` that are missing
130 from the remote but are pointing at commit-ish that are
131 - reachable from the refs being pushed.
131 + reachable from the refs being pushed. This can also be specified
132 + with configuration variable 'push.followTags'. For more
133 + information, see 'push.followTags' in linkgit:git-config[1].
134 +
135
136 --signed::
137 GPG-sign the push request to update refs on the receiving
builtin/push.c
+10
@@ -473,11 +473,21 @@ static int option_parse_recurse_submodules(const struct option *opt,
473
474 static int git_push_config(const char *k, const char *v, void *cb)
475 {
476 + int *flags = cb;
477 int status;
478
479 status = git_gpg_config(k, v, NULL);
480 if (status)
481 return status;
482 +
483 + if (!strcmp(k, "push.followtags")) {
484 + if (git_config_bool(k, v))
485 + *flags |= TRANSPORT_PUSH_FOLLOW_TAGS;
486 + else
487 + *flags &= ~TRANSPORT_PUSH_FOLLOW_TAGS;
488 + return 0;
489 + }
490 +
491 return git_default_config(k, v, NULL);
492 }
493
contrib/completion/git-completion.bash
+1
@@ -2188,6 +2188,7 @@ _git_config ()
2188 pull.octopus
2189 pull.twohead
2190 push.default
2191 + push.followTags
2192 rebase.autosquash
2193 rebase.stat
2194 receive.autogc