Signed-off-by: Dave Olszewski <cxreg@xxxxxxxxx> --- Documentation/config.txt | 6 ++++++ Documentation/git-push.txt | 5 ++++- builtin/push.c | 5 +++++ cache.h | 1 + config.c | 5 +++++ contrib/completion/git-completion.bash | 1 + environment.c | 1 + transport.c | 2 +- 8 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index ae6791d..e01d21c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -2079,6 +2079,12 @@ new default). -- +push.followTags:: + If set to true enable '--follow-tags' option by default. You + may override this configuration at time of push by specifying + '--no-follow-tags'. + + rebase.stat:: Whether to show a diffstat of what changed upstream since the last rebase. False by default. diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index ea97576..caa187b 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -128,7 +128,10 @@ already exists on the remote side. Push all the refs that would be pushed without this option, and also push annotated tags in `refs/tags` that are missing from the remote but are pointing at commit-ish that are - reachable from the refs being pushed. + reachable from the refs being pushed. This can also be specified + with configuration variable 'push.followTags'. For more + information, see 'push.followTags' in linkgit:git-config[1]. + --signed:: GPG-sign the push request to update refs on the receiving diff --git a/builtin/push.c b/builtin/push.c index fc771a9..47f0119 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -525,6 +525,11 @@ int cmd_push(int argc, const char **argv, const char *prefix) packet_trace_identity("push"); git_config(git_push_config, NULL); + + /* set TRANSPORT_PUSH_FOLLOW_TAGS in flags so that --no-follow-tags may unset it */ + if (push_follow_tags) + flags |= TRANSPORT_PUSH_FOLLOW_TAGS; + argc = parse_options(argc, argv, prefix, options, push_usage, 0); if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR)))) diff --git a/cache.h b/cache.h index f704af5..9318189 100644 --- a/cache.h +++ b/cache.h @@ -648,6 +648,7 @@ enum push_default_type { extern enum branch_track git_branch_track; extern enum rebase_setup_type autorebase; extern enum push_default_type push_default; +extern int push_follow_tags; enum object_creation_mode { OBJECT_CREATION_USES_HARDLINKS = 0, diff --git a/config.c b/config.c index e5e64dc..cb237cd 100644 --- a/config.c +++ b/config.c @@ -977,6 +977,11 @@ static int git_default_push_config(const char *var, const char *value) return 0; } + if (!strcmp(var, "push.followtags")) { + push_follow_tags = git_config_bool(var, value); + return 0; + } + /* Add other config variables here and to Documentation/config.txt. */ return 0; } diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c21190d..cffb2b8 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2188,6 +2188,7 @@ _git_config () pull.octopus pull.twohead push.default + push.followTags rebase.autosquash rebase.stat receive.autogc diff --git a/environment.c b/environment.c index 1ade5c9..aef9587 100644 --- a/environment.c +++ b/environment.c @@ -52,6 +52,7 @@ unsigned whitespace_rule_cfg = WS_DEFAULT_RULE; enum branch_track git_branch_track = BRANCH_TRACK_REMOTE; enum rebase_setup_type autorebase = AUTOREBASE_NEVER; enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED; +int push_follow_tags = 0; #ifndef OBJECT_CREATION_MODE #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS #endif diff --git a/transport.c b/transport.c index 0694a7c..ff5f63d 100644 --- a/transport.c +++ b/transport.c @@ -1148,7 +1148,7 @@ int transport_push(struct transport *transport, match_flags |= MATCH_REFS_MIRROR; if (flags & TRANSPORT_PUSH_PRUNE) match_flags |= MATCH_REFS_PRUNE; - if (flags & TRANSPORT_PUSH_FOLLOW_TAGS) + if ((flags & TRANSPORT_PUSH_FOLLOW_TAGS)) match_flags |= MATCH_REFS_FOLLOW_TAGS; if (match_push_refs(local_refs, &remote_refs, -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html