git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH] branch: change the error messages to be more meaningful
Date: Sun, 30 Jul 2017 17:29:08 +0530	[thread overview]
Message-ID: <20170730115908.13841-1-kaarticsivaraam91196@gmail.com> (raw)
In-Reply-To: <0102015d7b021c6c-8741d523-c7d7-4be5-923a-cd4a925842a0-000000@eu-west-1.amazonses.com>

The error messages shown when the branch command is misused
by supplying it wrong number of parameters wasn't meaningful.
That's because it used the the phrase "too many branches"
assuming all parameters to be "valid" branch names. It's not
always the case as exemplified below,

        $ git branch
          foo
        * master

        $ git branch -m foo foo old
        fatal: too many branches for a rename operation

Change the messages to be more general thus making no assumptions
about the "parameters".

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
---
 Sending this patch to the correct thread. I apologise if this
 seems reduntant. I'm having hard time keeping up with the patch-flow
 without 'send-email'!

 builtin/branch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index a3bd2262b..59fedf085 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -707,12 +707,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		else if (argc == 2)
 			rename_branch(argv[0], argv[1], rename > 1);
 		else
-			die(_("too many branches for a rename operation"));
+			die(_("too many parameters for a rename operation"));
 	} else if (new_upstream) {
 		struct branch *branch = branch_get(argv[0]);
 
 		if (argc > 1)
-			die(_("too many branches to set new upstream"));
+			die(_("too many parameters to set new upstream"));
 
 		if (!branch) {
 			if (!argc || !strcmp(argv[0], "HEAD"))
@@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		struct strbuf buf = STRBUF_INIT;
 
 		if (argc > 1)
-			die(_("too many branches to unset upstream"));
+			die(_("too many parameters to unset upstream"));
 
 		if (!branch) {
 			if (!argc || !strcmp(argv[0], "HEAD"))
-- 
2.14.0.rc1.434.g6eded367a


  parent reply	other threads:[~2017-07-30 11:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 14:39 [PATCH] branch: change the error messages to be more meaningful Kaartic Sivaraam
2017-07-25 18:28 ` Kaartic Sivaraam
2017-07-25 18:31   ` Kaartic Sivaraam
2017-07-30 11:59   ` Kaartic Sivaraam [this message]
2017-08-21 13:36     ` [PATCH v2] " Kaartic Sivaraam
2017-10-02 17:19       ` Kaartic Sivaraam
2017-10-03  0:21         ` Junio C Hamano
2017-10-03 19:14           ` Kaartic Sivaraam
2017-10-04  4:11             ` Junio C Hamano
2017-10-04 12:46               ` Kaartic Sivaraam
2017-10-05  1:13                 ` Junio C Hamano
2017-10-05 12:13                   ` Kaartic Sivaraam
  -- strict thread matches above, loose matches on Subject: below --
2017-07-26 13:18 [PATCH] remote: split and simplify messages Kaartic Sivaraam
2017-07-30 11:13 ` [PATCH] branch: change the error messages to be more meaningful Kaartic Sivaraam

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170730115908.13841-1-kaarticsivaraam91196@gmail.com \
    --to=kaarticsivaraam91196@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).