Skip to content

Commit a8bc269

Browse files
cxreggitster
authored andcommitted
push: allow --follow-tags to be set by config push.followTags
Signed-off-by: Dave Olszewski <[email protected]> Helped-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 06c21e1 commit a8bc269

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

Documentation/config.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,12 @@ new default).
20792079

20802080
--
20812081

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+
20822088
rebase.stat::
20832089
Whether to show a diffstat of what changed upstream since the last
20842090
rebase. False by default.

Documentation/git-push.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ already exists on the remote side.
128128
Push all the refs that would be pushed without this option,
129129
and also push annotated tags in `refs/tags` that are missing
130130
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+
132135

133136
--signed::
134137
GPG-sign the push request to update refs on the receiving

builtin/push.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,21 @@ static int option_parse_recurse_submodules(const struct option *opt,
473473

474474
static int git_push_config(const char *k, const char *v, void *cb)
475475
{
476+
int *flags = cb;
476477
int status;
477478

478479
status = git_gpg_config(k, v, NULL);
479480
if (status)
480481
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+
481491
return git_default_config(k, v, NULL);
482492
}
483493

contrib/completion/git-completion.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,7 @@ _git_config ()
21882188
pull.octopus
21892189
pull.twohead
21902190
push.default
2191+
push.followTags
21912192
rebase.autosquash
21922193
rebase.stat
21932194
receive.autogc

0 commit comments

Comments
 (0)