git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] branch: change the error messages to be more meaningful
@ 2017-07-25 14:39 Kaartic Sivaraam
  2017-07-25 18:28 ` Kaartic Sivaraam
  0 siblings, 1 reply; 14+ messages in thread
From: Kaartic Sivaraam @ 2017-07-25 14:39 UTC (permalink / raw)
  To: git

The error messages shown when the branch command is misused
by supplying it wrong number of parameters wasn't meaningful
as it used the the phrase, "too many branches" which is not
meaningful in the following case,

        $ git branch
          foo
        * master

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

It's not meaningful as the implementation assumed all parameters
to be branch names. It's not always the case as exemplified above.

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

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
---
 builtin/branch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index a3bd2262b3367..59fedf085d3db 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"))

--
https://github.com/git/git/pull/387

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* Re: [PATCH] commit & merge: modularize the empty message validator
@ 2017-07-15  8:33 Kaartic Sivaraam
  2017-08-21 13:34 ` [PATCH v2] branch: change the error messages to be more meaningful Kaartic Sivaraam
  0 siblings, 1 reply; 14+ messages in thread
From: Kaartic Sivaraam @ 2017-07-15  8:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, me

On Fri, 2017-07-14 at 23:19 +0530, Kaartic Sivaraam wrote:
>         * Imagine a hypothetical version of git that aborts when the
>         <message> is empty though a <trailer> is present. This would
>         quite possibly instigate controversies as the "hypothetical git"
>         reduces the "valid commit messages" and would quite possibly
>         reject a commit message as "empty" (which is uncommunicative)
>         though a previous version (which did not have this change)
>         accepted a similar message.
> 
>         SO, bringing in the Occam's razor, let's choose the option that's
>         the simplest and makes the fewest assumptions.
I would like to add a little to the "making fewer assumptions" point.
If we make the fewest assumptions possible, it has quite a few
advantages,

* It would make the implementation that checks for an empty message,
trivial. Thus reducing the complexity of the code.

* It would not overload the meaning of the error message,

    Aborting due to empty commit message.

Thus making the sentence stand for what it means "literally". 
(BTW, I guess an "an" is missing in the message)

* It allows for others to have more freedom in defining what a commit
message should have using the appropriate hook(s). IOW, let us do the
minimal check(message consisting only of whitespaces) and let the
others define what a commit message should have using the "commit-msg"
hook.

-- 
Kaartic

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-10-05 12:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` [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-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

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).