git-check-attr: Handle each error separately

This will make the code easier to refactor. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Aug 4, 2011 at 06:36 UTC 27937447efdf2b50e6294e94bde22f07c526b2de
1 file changed +4 -7
builtin/check-attr.c
+4 -7
@@ -78,7 +78,6 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
78 {
79 struct git_attr_check *check;
80 int cnt, i, doubledash, filei;
81 - const char *errstr = NULL;
81
82 argc = parse_options(argc, argv, prefix, check_attr_options,
83 check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
@@ -105,12 +104,10 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
104 }
105
106 if (cnt <= 0)
108 - errstr = "No attribute specified";
109 - else if (stdin_paths && filei < argc)
110 - errstr = "Can't specify files with --stdin";
111 - if (errstr) {
112 - error_with_usage(errstr);
113 - }
107 + error_with_usage("No attribute specified");
108 +
109 + if (stdin_paths && filei < argc)
110 + error_with_usage("Can't specify files with --stdin");
111
112 check = xcalloc(cnt, sizeof(*check));
113 for (i = 0; i < cnt; i++) {