{"thread":{"id":"38570","subject":"[PATCH] push: allow --follow-tags' to be set by config push.followTags","startedAt":"2015-02-15T23:39:48Z","lastAt":"2015-02-16T03:01:16Z","messageCount":3,"participants":["Dave Olszewski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"256114","messageId":"1424043588-15994-1-git-send-email-cxreg@pobox.com","threadId":"38570","inReplyTo":null,"subject":"[PATCH] push: allow --follow-tags' to be set by config push.followTags","fromName":"Dave Olszewski","fromEmail":"cxreg@pobox.com","sentAt":"2015-02-15T23:39:48Z","receivedAt":"2015-02-15T23:39:48Z","isPatch":true,"sender":{"key":"cxreg@pobox.com","avatar":"https://avatars.githubusercontent.com/u/55474?v=4"},"body":"Signed-off-by: Dave Olszewski <cxreg@pobox.com>\n---\n Documentation/config.txt               | 3 +++\n Documentation/git-push.txt             | 5 ++++-\n cache.h                                | 1 +\n config.c                               | 5 +++++\n contrib/completion/git-completion.bash | 1 +\n environment.c                          | 1 +\n transport.c                            | 2 +-\n 7 files changed, 16 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex ae6791d..cdb8a99 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2079,6 +2079,9 @@ new default).\n \n --\n \n+push.followTags::\n+\tIf set to true enable '--follow-tags' option by default.\n+\n rebase.stat::\n \tWhether to show a diffstat of what changed upstream since the last\n \trebase. False by default.\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex ea97576..caa187b 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -128,7 +128,10 @@ already exists on the remote side.\n \tPush all the refs that would be pushed without this option,\n \tand also push annotated tags in `refs/tags` that are missing\n \tfrom the remote but are pointing at commit-ish that are\n-\treachable from the refs being pushed.\n+\treachable from the refs being pushed.  This can also be specified\n+\twith configuration variable 'push.followTags'.  For more\n+\tinformation, see 'push.followTags' in linkgit:git-config[1].\n+\n \n --signed::\n \tGPG-sign the push request to update refs on the receiving\ndiff --git a/cache.h b/cache.h\nindex f704af5..9318189 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -648,6 +648,7 @@ enum push_default_type {\n extern enum branch_track git_branch_track;\n extern enum rebase_setup_type autorebase;\n extern enum push_default_type push_default;\n+extern int push_follow_tags;\n \n enum object_creation_mode {\n \tOBJECT_CREATION_USES_HARDLINKS = 0,\ndiff --git a/config.c b/config.c\nindex e5e64dc..cb237cd 100644\n--- a/config.c\n+++ b/config.c\n@@ -977,6 +977,11 @@ static int git_default_push_config(const char *var, const char *value)\n \t\treturn 0;\n \t}\n \n+\tif (!strcmp(var, \"push.followtags\")) {\n+\t\tpush_follow_tags = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n \t/* Add other config variables here and to Documentation/config.txt. */\n \treturn 0;\n }\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c21190d..cffb2b8 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2188,6 +2188,7 @@ _git_config ()\n \t\tpull.octopus\n \t\tpull.twohead\n \t\tpush.default\n+\t\tpush.followTags\n \t\trebase.autosquash\n \t\trebase.stat\n \t\treceive.autogc\ndiff --git a/environment.c b/environment.c\nindex 1ade5c9..aef9587 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -52,6 +52,7 @@ unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;\n enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;\n enum rebase_setup_type autorebase = AUTOREBASE_NEVER;\n enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;\n+int push_follow_tags = 0;\n #ifndef OBJECT_CREATION_MODE\n #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS\n #endif\ndiff --git a/transport.c b/transport.c\nindex 0694a7c..87cd657 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1148,7 +1148,7 @@ int transport_push(struct transport *transport,\n \t\t\tmatch_flags |= MATCH_REFS_MIRROR;\n \t\tif (flags & TRANSPORT_PUSH_PRUNE)\n \t\t\tmatch_flags |= MATCH_REFS_PRUNE;\n-\t\tif (flags & TRANSPORT_PUSH_FOLLOW_TAGS)\n+\t\tif ((flags & TRANSPORT_PUSH_FOLLOW_TAGS) || push_follow_tags)\n \t\t\tmatch_flags |= MATCH_REFS_FOLLOW_TAGS;\n \n \t\tif (match_push_refs(local_refs, &remote_refs,\n-- \n2.1.4\n"},{"id":"256115","messageId":"CAPc5daXkf3Vc-kGsqQ4zo6qSMrh93GZbXeFK9oLwajyNahmx1Q@mail.gmail.com","threadId":"38570","inReplyTo":"1424043588-15994-1-git-send-email-cxreg@pobox.com","subject":"Re: [PATCH] push: allow --follow-tags' to be set by config push.followTags","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-16T00:01:04Z","receivedAt":"2015-02-16T00:01:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Sun, Feb 15, 2015 at 3:39 PM, Dave Olszewski <cxreg@pobox.com> wrote:\n> Signed-off-by: Dave Olszewski <cxreg@pobox.com>\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index ae6791d..cdb8a99 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -2079,6 +2079,9 @@ new default).\n>\n>  --\n>\n> +push.followTags::\n> +       If set to true enable '--follow-tags' option by default.\n> +\n\nAfter setting this in your repository, does \"git push --no-follow-tags\" let\nyou override it if you want to do so for a single invocation?\n\nIf it does, the code is good but it should be documented here; if it\ndoes not, it should be corrected and it should be documented here.\n\nThanks.\n"},{"id":"256118","messageId":"alpine.DEB.2.11.1502151859230.16979@narbuckle.genericorp.net","threadId":"38570","inReplyTo":"CAPc5daXkf3Vc-kGsqQ4zo6qSMrh93GZbXeFK9oLwajyNahmx1Q@mail.gmail.com","subject":"Re: Re: [PATCH] push: allow --follow-tags' to be set by config push.followTags","fromName":"Dave Olszewski","fromEmail":"cxreg@pobox.com","sentAt":"2015-02-16T03:01:16Z","receivedAt":"2015-02-16T03:01:16Z","isPatch":true,"sender":{"key":"cxreg@pobox.com","avatar":"https://avatars.githubusercontent.com/u/55474?v=4"},"body":"On Sun, 15 Feb 2015, Junio C Hamano wrote:\n\n> On Sun, Feb 15, 2015 at 3:39 PM, Dave Olszewski <cxreg@pobox.com> wrote:\n> > Signed-off-by: Dave Olszewski <cxreg@pobox.com>\n> >\n> > diff --git a/Documentation/config.txt b/Documentation/config.txt\n> > index ae6791d..cdb8a99 100644\n> > --- a/Documentation/config.txt\n> > +++ b/Documentation/config.txt\n> > @@ -2079,6 +2079,9 @@ new default).\n> >\n> >  --\n> >\n> > +push.followTags::\n> > +       If set to true enable '--follow-tags' option by default.\n> > +\n> \n> After setting this in your repository, does \"git push --no-follow-tags\" let\n> you override it if you want to do so for a single invocation?\n> \n> If it does, the code is good but it should be documented here; if it\n> does not, it should be corrected and it should be documented here.\n> \n> Thanks.\n\nThanks for the feedback.  I was able to get this behavior by setting the\nconfig value into the flags variable before parsing command line\noptions.  Hopefully this is acceptable practice.  Updated patch coming\nshortly\n"}]}