[PATCH] push: allow --follow-tags' to be set by config push.followTags

Subsystems: documentation, the rest

DORMANTno replies

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] push: allow --follow-tags' to be set by config push.followTags

From: Dave Olszewski <hidden>
Date: 2016-06-15 23:03:49

Signed-off-by: Dave Olszewski <redacted>
---
 Documentation/config.txt               | 3 +++
 Documentation/git-push.txt             | 5 ++++-
 cache.h                                | 1 +
 config.c                               | 5 +++++
 contrib/completion/git-completion.bash | 1 +
 environment.c                          | 1 +
 transport.c                            | 2 +-
 7 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index ae6791d..cdb8a99 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2079,6 +2079,9 @@ new default).
 
 --
 
+push.followTags::
+	If set to true enable '--follow-tags' option by default.
+
 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/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..87cd657 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) || push_follow_tags)
 			match_flags |= MATCH_REFS_FOLLOW_TAGS;
 
 		if (match_push_refs(local_refs, &remote_refs,
-- 
2.1.4

Re: [PATCH] push: allow --follow-tags' to be set by config push.followTags

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:03:49

On Sun, Feb 15, 2015 at 3:39 PM, Dave Olszewski [off-list ref] wrote:
quoted hunk
Signed-off-by: Dave Olszewski <redacted>
diff --git a/Documentation/config.txt b/Documentation/config.txt
index ae6791d..cdb8a99 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2079,6 +2079,9 @@ new default).

 --

+push.followTags::
+       If set to true enable '--follow-tags' option by default.
+
After setting this in your repository, does "git push --no-follow-tags" let
you override it if you want to do so for a single invocation?

If it does, the code is good but it should be documented here; if it
does not, it should be corrected and it should be documented here.

Thanks.

Re: Re: [PATCH] push: allow --follow-tags' to be set by config push.followTags

From: Dave Olszewski <hidden>
Date: 2016-06-15 23:03:49

On Sun, 15 Feb 2015, Junio C Hamano wrote:
On Sun, Feb 15, 2015 at 3:39 PM, Dave Olszewski [off-list ref] wrote:
quoted
Signed-off-by: Dave Olszewski <redacted>
diff --git a/Documentation/config.txt b/Documentation/config.txt
index ae6791d..cdb8a99 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2079,6 +2079,9 @@ new default).

 --

+push.followTags::
+       If set to true enable '--follow-tags' option by default.
+
After setting this in your repository, does "git push --no-follow-tags" let
you override it if you want to do so for a single invocation?

If it does, the code is good but it should be documented here; if it
does not, it should be corrected and it should be documented here.

Thanks.
Thanks for the feedback.  I was able to get this behavior by setting the
config value into the flags variable before parsing command line
options.  Hopefully this is acceptable practice.  Updated patch coming
shortly
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help