summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-08-04 04:36:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-04 22:53:19 (GMT)
commitfdf6be8259fc59fc251b325f66e86df0fe905e79 (patch)
tree8c15c88e07bbed40cc1b1db6fab25bcddda6f9b4 /builtin
parent72541040c3ed00084344de5bf75cbc5a514504bb (diff)
downloadgit-fdf6be8259fc59fc251b325f66e86df0fe905e79.zip
git-fdf6be8259fc59fc251b325f66e86df0fe905e79.tar.gz
git-fdf6be8259fc59fc251b325f66e86df0fe905e79.tar.bz2
git-check-attr: Error out if no pathnames are specified
If no pathnames are passed as command-line arguments and the --stdin option is not specified, fail with the error message "No file specified". Add tests of this behavior. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/check-attr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index e9b827f..6cf6421 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -111,8 +111,13 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
}
/* Check file argument(s): */
- if (stdin_paths && filei < argc)
- error_with_usage("Can't specify files with --stdin");
+ if (stdin_paths) {
+ if (filei < argc)
+ error_with_usage("Can't specify files with --stdin");
+ } else {
+ if (filei >= argc)
+ error_with_usage("No file specified");
+ }
check = xcalloc(cnt, sizeof(*check));
for (i = 0; i < cnt; i++) {