git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rebase: do not print lots of usage hints after an obvious error message
@ 2011-06-28 12:46 Johannes Sixt
  2011-06-28 15:54 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Sixt @ 2011-06-28 12:46 UTC (permalink / raw)
  To: Jeff King; +Cc: Git Mailing List

From: Johannes Sixt <j6t@kdbg.org>

When a non-existent branch was specified to be rebased, the complete
usage information is printed after the error message that carries the
relevant piece of information:

   $ git rebase master topci
   fatal: no such branch: topci
   usage: git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]
      or: git rebase [-i] [options] --onto <newbase> --root [<branch>]
      or: git-rebase [-i] --continue | --abort | --skip

   Available options are
   [30 lines of usage stripped]

The error message was introduced recently by 4ac5356c (rebase: give a
better error message for bogus branch, 2011-01-27), and the result was
acceptable because the usage text was just two lines. But 45e2acf3
(rebase: define options in OPTIONS_SPEC, 2011-02-28) made things worse
because the usage text is now 35 lines.

Just drop the usage information because it does not add value to the
error message.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 Note: git-sh-setup's die() does not print "fatal: ".

 git-rebase.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index d7855ea..4761f28 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -441,8 +441,7 @@ case "$#" in
 	then
 		head_name="detached HEAD"
 	else
-		echo >&2 "fatal: no such branch: $1"
-		usage
+		die "fatal: no such branch: $1"
 	fi
 	;;
 *)
-- 
1.7.6.86.gdfda2

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

* Re: [PATCH] rebase: do not print lots of usage hints after an obvious error message
  2011-06-28 12:46 [PATCH] rebase: do not print lots of usage hints after an obvious error message Johannes Sixt
@ 2011-06-28 15:54 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2011-06-28 15:54 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List

On Tue, Jun 28, 2011 at 02:46:14PM +0200, Johannes Sixt wrote:

> The error message was introduced recently by 4ac5356c (rebase: give a
> better error message for bogus branch, 2011-01-27), and the result was
> acceptable because the usage text was just two lines. But 45e2acf3
> (rebase: define options in OPTIONS_SPEC, 2011-02-28) made things worse
> because the usage text is now 35 lines.
> 
> Just drop the usage information because it does not add value to the
> error message.

Acked-by: Jeff King <peff@peff.net>

A git-sh-setup function to print just the summary bit of the usage would
restore the original behavior, but I agree it's not really adding
anything.

-Peff

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

end of thread, other threads:[~2011-06-28 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-28 12:46 [PATCH] rebase: do not print lots of usage hints after an obvious error message Johannes Sixt
2011-06-28 15:54 ` Jeff King

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 NNTP newsgroup(s).