summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7254104)
raw | patch | inline | side by side (parent: 7254104)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Thu, 4 Aug 2011 04:36:29 +0000 (06:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Aug 2011 22:53:19 +0000 (15:53 -0700) |
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>
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>
builtin/check-attr.c | patch | blob | history | |
t/t0003-attributes.sh | patch | blob | history |
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index e9b827ffb58f10d3cdcb73e45e332e34ae2b47ed..6cf6421399644b359e08ea84493de419c71bc941 100644 (file)
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
}
/* 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++) {
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index f1debeb7ad872a501f11c951a1312bc8901b5e49..22540051d8db357379a7512a7d4c4e875227fe2e 100755 (executable)
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
test_must_fail git check-attr &&
test_must_fail git check-attr -- &&
+ test_must_fail git check-attr test &&
+ test_must_fail git check-attr test -- &&
test_must_fail git check-attr -- f &&
echo "f" | test_must_fail git check-attr --stdin &&
echo "f" | test_must_fail git check-attr --stdin -- f &&