All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] push: allow --follow-tags to be set by config push.followTags
@ 2015-02-16  3:01 Dave Olszewski
  2015-02-16  5:20 ` Jeff King
  0 siblings, 1 reply; 29+ messages in thread
From: Dave Olszewski @ 2015-02-16  3:01 UTC (permalink / raw)
  To: git, gitster; +Cc: Dave Olszewski

Signed-off-by: Dave Olszewski <cxreg@pobox.com>
---
 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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2015-03-14 22:08 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16  3:01 [PATCH] push: allow --follow-tags to be set by config push.followTags Dave Olszewski
2015-02-16  5:20 ` Jeff King
2015-02-16  5:45   ` [PATCH 0/2] clean up push config callbacks Jeff King
2015-02-16  5:46     ` [PATCH 1/2] git_push_config: drop cargo-culted wt_status pointer Jeff King
2015-02-16  5:47     ` [PATCH 2/2] builtin/push.c: make push_default a static variable Jeff King
2015-02-16  5:57       ` Junio C Hamano
2015-02-17 10:46       ` Jeff King
2015-02-17 17:45         ` Junio C Hamano
2015-02-17 18:23           ` Jeff King
2015-02-17 22:16             ` Junio C Hamano
2015-02-18 18:50               ` Jeff King
2015-02-18 19:08                 ` Junio C Hamano
2015-02-18 19:25                   ` Jeff King
2015-02-18 19:50                     ` Junio C Hamano
2015-02-18 20:03                       ` Jeff King
2015-02-16  5:54     ` [PATCH 3/2] push: allow --follow-tags to be set by config push.followTags Jeff King
2015-02-16  6:02       ` Junio C Hamano
2015-02-16  6:10         ` [PATCH 0/3] cleaner bit-setting in cmd_push Jeff King
2015-02-16  6:12           ` [PATCH 1/3] cmd_push: set "atomic" bit directly Jeff King
2015-02-16  6:13           ` [PATCH 2/3] cmd_push: pass "flags" pointer to config callback Jeff King
2015-02-16  7:05             ` Junio C Hamano
2015-02-16  7:16               ` Jeff King
2015-02-16  6:16           ` [PATCH 3/3] push: allow --follow-tags to be set by config push.followTags Jeff King
2015-03-14  6:06             ` Junio C Hamano
2015-03-14 17:34               ` Jeff King
2015-03-14 17:50               ` Dave Olszewski
2015-03-14 22:08                 ` Junio C Hamano
2015-02-16  6:11         ` [PATCH 3/2] " Junio C Hamano
2015-02-16  6:17           ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.