提交 b259f09b 编写于 作者: M Marek Zawirski 提交者: Junio C Hamano

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: NMarek Zawirski <marek.zawirski@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 053fd0c1
......@@ -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)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册