Skip to content

Commit

Permalink
Make push more verbose about illegal combination of options
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marek Zawirski authored and Junio C Hamano committed Aug 17, 2008
1 parent 053fd0c commit b259f09
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions builtin-push.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit b259f09

Please sign in to comment.