summaryrefslogtreecommitdiff
path: root/builtin-push.c
diff options
context:
space:
mode:
authorMarek Zawirski <marek.zawirski@gmail.com>2008-08-16 19:58:32 +0200
committerJunio C Hamano <gitster@pobox.com>2008-08-17 00:24:21 -0700
commitb259f09b181c6650253f2ab60f5375d3ff8e3872 (patch)
treee8331f7c7b1a60fe810358a3a1bb21418822f5fb /builtin-push.c
parent053fd0c1c3da20474c4ff175c56ea4c1d6eeda11 (diff)
downloadgit-b259f09b181c6650253f2ab60f5375d3ff8e3872.tar.gz
Make push more verbose about illegal combination of options
It may be unclear that --all, --mirror, --tags and/or explicit refspecs are illegal combinations for git push. Git was silently failing in these cases, while we can complaint more properly about it. Signed-off-by: Marek Zawirski <marek.zawirski@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-push.c')
-rw-r--r--builtin-push.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/builtin-push.c b/builtin-push.c
index c1ed68d938..cc6666f75e 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -59,8 +59,17 @@ static int do_push(const char *repo, int flags)
if (remote->mirror)
flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
- if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) && refspec)
- return -1;
+ if ((flags & TRANSPORT_PUSH_ALL) && refspec) {
+ if (!strcmp(*refspec, "refs/tags/*"))
+ return error("--all and --tags are incompatible");
+ return error("--all can't be combined with refspecs");
+ }
+
+ if ((flags & TRANSPORT_PUSH_MIRROR) && refspec) {
+ if (!strcmp(*refspec, "refs/tags/*"))
+ return error("--mirror and --tags are incompatible");
+ return error("--mirror can't be combined with refspecs");
+ }
if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) ==
(TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) {