diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-08-04 06:36:27 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-04 15:53:19 -0700 |
commit | 27937447efdf2b50e6294e94bde22f07c526b2de (patch) | |
tree | dfb3a72cb4de747ba7b51f1cfe81cf28c70f9b22 /builtin/check-attr.c | |
parent | git-check-attr: Extract a function error_with_usage() (diff) | |
download | tgif-27937447efdf2b50e6294e94bde22f07c526b2de.tar.xz |
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>
Diffstat (limited to 'builtin/check-attr.c')
-rw-r--r-- | builtin/check-attr.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/builtin/check-attr.c b/builtin/check-attr.c index d0042227c2..de3fef7348 100644 --- a/builtin/check-attr.c +++ b/builtin/check-attr.c @@ -78,7 +78,6 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix) { struct git_attr_check *check; int cnt, i, doubledash, filei; - const char *errstr = NULL; argc = parse_options(argc, argv, prefix, check_attr_options, check_attr_usage, PARSE_OPT_KEEP_DASHDASH); @@ -105,12 +104,10 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix) } if (cnt <= 0) - errstr = "No attribute specified"; - else if (stdin_paths && filei < argc) - errstr = "Can't specify files with --stdin"; - if (errstr) { - error_with_usage(errstr); - } + error_with_usage("No attribute specified"); + + if (stdin_paths && filei < argc) + error_with_usage("Can't specify files with --stdin"); check = xcalloc(cnt, sizeof(*check)); for (i = 0; i < cnt; i++) { |