From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Michael Darling <darlingm@gmail.com>, git@vger.kernel.org
Subject: Re: BUG: For first push to a bare repo, using "--tags" prevents creation of master branch
Date: Fri, 29 May 2015 09:40:43 -0700 [thread overview]
Message-ID: <xmqq617be3qs.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqeglze5cu.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Fri, 29 May 2015 09:05:53 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> I recall "fetch --tags" was updated to become your "--tags-also" by
> e66ef7ae (Merge branch 'mh/fetch-tags-in-addition-to-normal-refs',
> 2013-12-12). Perhaps we should do the same on the push side.
builtin/push.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/builtin/push.c b/builtin/push.c
index 57c138b..ec215d7 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -382,7 +382,7 @@ static int push_with_options(struct transport *transport, int flags)
return 1;
}
-static int do_push(const char *repo, int flags)
+static int do_push(const char *repo, int flags, int tags_too)
{
int i, errs;
struct remote *remote = pushremote_get(repo);
@@ -429,6 +429,10 @@ static int do_push(const char *repo, int flags)
} else if (!(flags & TRANSPORT_PUSH_MIRROR))
setup_default_push_refspecs(remote);
}
+
+ if (tags_too)
+ add_refspec("refs/tags/*");
+
errs = 0;
url_nr = push_url_of_remote(remote, &url);
if (url_nr) {
@@ -494,7 +498,7 @@ static int git_push_config(const char *k, const char *v, void *cb)
int cmd_push(int argc, const char **argv, const char *prefix)
{
int flags = 0;
- int tags = 0;
+ int tags_too = 0;
int rc;
const char *repo = NULL; /* default repository */
struct option options[] = {
@@ -504,7 +508,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
OPT_BIT( 0 , "mirror", &flags, N_("mirror all refs"),
(TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
OPT_BOOL( 0, "delete", &deleterefs, N_("delete refs")),
- OPT_BOOL( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")),
+ OPT_BOOL( 0 , "tags", &tags_too, N_("push tags (can't be used with --all or --mirror)")),
OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
OPT_BIT( 0, "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE),
@@ -535,20 +539,18 @@ int cmd_push(int argc, const char **argv, const char *prefix)
git_config(git_push_config, &flags);
argc = parse_options(argc, argv, prefix, options, push_usage, 0);
- if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
+ if (deleterefs &&
+ (tags_too || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
die(_("--delete is incompatible with --all, --mirror and --tags"));
if (deleterefs && argc < 2)
die(_("--delete doesn't make sense without any refs"));
- if (tags)
- add_refspec("refs/tags/*");
-
if (argc > 0) {
repo = argv[0];
set_refspecs(argv + 1, argc - 1, repo);
}
- rc = do_push(repo, flags);
+ rc = do_push(repo, flags, tags_too);
if (rc == -1)
usage_with_options(push_usage, options);
else
next prev parent reply other threads:[~2015-05-29 16:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 0:10 BUG: For first push to a bare repo, using "--tags" prevents creation of master branch Michael Darling
2015-05-29 5:35 ` Matthieu Moy
2015-05-29 15:21 ` Junio C Hamano
2015-05-29 15:45 ` Matthieu Moy
2015-05-29 16:05 ` Junio C Hamano
2015-05-29 16:40 ` Junio C Hamano [this message]
2015-05-29 17:53 ` Matthieu Moy
2015-05-29 18:03 ` Junio C Hamano
2015-06-02 23:48 ` Not a " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq617be3qs.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=darlingm@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.