Skip to content

Commit a429d2d

Browse files
bebarinogitster
authored andcommitted
read-tree: convert unhelpful usage()'s to helpful die()'s
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 916e137 commit a429d2d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin-read-tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
145145
continue;
146146
}
147147

148-
/* using -u and -i at the same time makes no sense */
149148
if (1 < opts.index_only + opts.update)
150-
usage(read_tree_usage);
149+
die("-u and -i at the same time makes no sense");
151150

152151
if (get_sha1(arg, sha1))
153152
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)
156155
stage++;
157156
}
158157
if ((opts.update||opts.index_only) && !opts.merge)
159-
usage(read_tree_usage);
158+
die("%s is meaningless without -m, --reset, or --prefix",
159+
opts.update ? "-u" : "-i");
160160
if ((opts.dir && !opts.update))
161161
die("--exclude-per-directory is meaningless unless -u");
162162
if (opts.merge && !opts.index_only)

0 commit comments

Comments
 (0)