{"thread":{"id":"15037","subject":"[PATCH] Make push more verbosive about illegal combination of options","startedAt":"2008-08-16T17:58:32Z","lastAt":"2008-08-16T17:58:32Z","messageCount":1,"participants":["Marek Zawirski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"87383","messageId":"1218909512-13083-1-git-send-email-marek.zawirski@gmail.com","threadId":"15037","inReplyTo":null,"subject":"[PATCH] Make push more verbosive about illegal combination of options","fromName":"Marek Zawirski","fromEmail":"marek.zawirski@gmail.com","sentAt":"2008-08-16T17:58:32Z","receivedAt":"2008-08-16T17:58:32Z","isPatch":true,"sender":{"key":"marek.zawirski@gmail.com","avatar":null},"body":"It may be unclear that --all (or even --mirror?) and --tags or explicit\nrefspecs are illegal combinations for git push.\n\nGit was silently failing for these cases, while we can complaint more\nproperly about it.\n\nSigned-off-by: Marek Zawirski <marek.zawirski@gmail.com>\n---\nI forgot about this one, it was reported long time ago:\nhttp://thread.gmane.org/gmane.comp.version-control.git/85229\n\nIt seems that it may be really unclear what's going on with git failing on\n$ git push --tags --all\nand similar, as it is implementation related perhaps.\n\nIf it's not allowed, let's just inform, hm?\n\n builtin-push.c |   13 +++++++++++--\n 1 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-push.c b/builtin-push.c\nindex c1ed68d..cc6666f 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -59,8 +59,17 @@ static int do_push(const char *repo, int flags)\n \tif (remote->mirror)\n \t\tflags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);\n \n-\tif ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) && refspec)\n-\t\treturn -1;\n+\tif ((flags & TRANSPORT_PUSH_ALL) && refspec) {\n+\t\tif (!strcmp(*refspec, \"refs/tags/*\"))\n+\t\t\treturn error(\"--all and --tags are incompatible\");\n+\t\treturn error(\"--all can't be combined with refspecs\");\n+\t}\n+\n+\tif ((flags & TRANSPORT_PUSH_MIRROR) && refspec) {\n+\t\tif (!strcmp(*refspec, \"refs/tags/*\"))\n+\t\t\treturn error(\"--mirror and --tags are incompatible\");\n+\t\treturn error(\"--mirror can't be combined with refspecs\");\n+\t}\n \n \tif ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) ==\n \t\t\t\t(TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) {\n-- \n1.5.6.3\n"}]}