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 v2] branch: change the error messages to be more meaningful
Date: Mon, 21 Aug 2017 19:06:08 +0530	[thread overview]
Message-ID: <20170821133608.5652-1-kaarticsivaraam91196@gmail.com> (raw)
In-Reply-To: <20170730115908.13841-1-kaarticsivaraam91196@gmail.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>
---
 Changes in v2:

    - changed the wordings of the error message

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

diff --git a/builtin/branch.c b/builtin/branch.c
index a3bd2262b..62981d358 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 arguments 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 arguments 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 arguments to unset upstream"));
 
 		if (!branch) {
 			if (!argc || !strcmp(argv[0], "HEAD"))
-- 
2.14.0.rc1.434.g6eded367a


  reply	other threads:[~2017-08-21 13:35 UTC|newest]

Thread overview: 14+ 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
2017-08-21 13:36     ` Kaartic Sivaraam [this message]
2017-10-02 17:19       ` [PATCH v2] " 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-15  8:33 [PATCH] commit & merge: modularize the empty message validator Kaartic Sivaraam
2017-08-21 13:34 ` [PATCH v2] branch: change the error messages to be more meaningful Kaartic Sivaraam
2017-08-21 13:52   ` 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=20170821133608.5652-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).