git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] read-tree: convert unhelpful usage()'s to helpful die()'s
@ 2009-06-24  4:27 Stephen Boyd
  2009-06-24  4:27 ` [PATCH 2/2] read-tree: migrate to parse-options Stephen Boyd
  2009-06-26  5:14 ` [PATCHv3 1/2] read-tree: convert unhelpful usage()'s to helpful die()'s Stephen Boyd
  0 siblings, 2 replies; 12+ messages in thread
From: Stephen Boyd @ 2009-06-24  4:27 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Printing the usage message when encountering bad option combinations is
not very helpful. Instead, die with a message which tells the user
exactly what combination is invalid.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
 builtin-read-tree.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 82e25ea..887e177 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -145,9 +145,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 			continue;
 		}
 
-		/* using -u and -i at the same time makes no sense */
 		if (1 < opts.index_only + opts.update)
-			usage(read_tree_usage);
+			die("-u and -i at the same time makes no sense");
 
 		if (get_sha1(arg, sha1))
 			die("Not a valid object name %s", arg);
@@ -156,7 +155,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 		stage++;
 	}
 	if ((opts.update||opts.index_only) && !opts.merge)
-		usage(read_tree_usage);
+		die("%s is meaningless without -m",
+		    opts.update ? "-u" : "-i");
 	if ((opts.dir && !opts.update))
 		die("--exclude-per-directory is meaningless unless -u");
 	if (opts.merge && !opts.index_only)
-- 
1.6.3.3.334.g916e1

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

end of thread, other threads:[~2009-06-27  2:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-24  4:27 [PATCH 1/2] read-tree: convert unhelpful usage()'s to helpful die()'s Stephen Boyd
2009-06-24  4:27 ` [PATCH 2/2] read-tree: migrate to parse-options Stephen Boyd
2009-06-24  5:08   ` Junio C Hamano
2009-06-25  1:36     ` Stephen Boyd
2009-06-25  5:06   ` [PATCHv2 " Stephen Boyd
2009-06-25  6:55     ` Johannes Sixt
2009-06-26  3:15       ` Stephen Boyd
2009-06-26  5:14 ` [PATCHv3 1/2] read-tree: convert unhelpful usage()'s to helpful die()'s Stephen Boyd
2009-06-26  5:14   ` [PATCHv3 2/2] read-tree: migrate to parse-options Stephen Boyd
2009-06-26  5:29     ` Stephen Boyd
2009-06-26 17:23       ` Junio C Hamano
2009-06-27  2:00         ` Stephen Boyd

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