Browse Source

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>
maint
Michael Haggerty 14 years ago committed by Junio C Hamano
parent
commit
27937447ef
  1. 11
      builtin/check-attr.c

11
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; struct git_attr_check *check;
int cnt, i, doubledash, filei; int cnt, i, doubledash, filei;
const char *errstr = NULL;


argc = parse_options(argc, argv, prefix, check_attr_options, argc = parse_options(argc, argv, prefix, check_attr_options,
check_attr_usage, PARSE_OPT_KEEP_DASHDASH); 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) if (cnt <= 0)
errstr = "No attribute specified"; error_with_usage("No attribute specified");
else if (stdin_paths && filei < argc)
errstr = "Can't specify files with --stdin"; if (stdin_paths && filei < argc)
if (errstr) { error_with_usage("Can't specify files with --stdin");
error_with_usage(errstr);
}


check = xcalloc(cnt, sizeof(*check)); check = xcalloc(cnt, sizeof(*check));
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {

Loading…
Cancel
Save