Skip to content

Commit

Permalink
read-tree: convert unhelpful usage()'s to helpful die()'s
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Stephen Boyd authored and Junio C Hamano committed Jun 27, 2009
1 parent 916e137 commit a429d2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions builtin-read-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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, --reset, or --prefix",
opts.update ? "-u" : "-i");
if ((opts.dir && !opts.update))
die("--exclude-per-directory is meaningless unless -u");
if (opts.merge && !opts.index_only)
Expand Down

0 comments on commit a429d2d

Please sign in to comment.