summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2793744)
raw | patch | inline | side by side (parent: 2793744)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Thu, 4 Aug 2011 04:36:28 +0000 (06:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Aug 2011 22:53:19 +0000 (15:53 -0700) |
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/check-attr.c | patch | blob | history |
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index de3fef734846e8d9e6f7de2709546fe1a22c866b..e9b827ffb58f10d3cdcb73e45e332e34ae2b47ed 100644 (file)
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
argc = parse_options(argc, argv, prefix, check_attr_options,
check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
- if (!argc)
- usage_with_options(check_attr_usage, check_attr_options);
if (read_cache() < 0) {
die("invalid cache");
doubledash = i;
}
- /* If there is no double dash, we handle only one attribute */
- if (doubledash < 0) {
+ /* Check attribute argument(s): */
+ if (doubledash == 0) {
+ error_with_usage("No attribute specified");
+ } else if (doubledash < 0) {
+ /*
+ * There is no double dash; treat the first
+ * argument as an attribute.
+ */
+ if (!argc)
+ error_with_usage("No attribute specified");
+
cnt = 1;
filei = 1;
} else {
filei = doubledash + 1;
}
- if (cnt <= 0)
- error_with_usage("No attribute specified");
-
+ /* Check file argument(s): */
if (stdin_paths && filei < argc)
error_with_usage("Can't specify files with --stdin");