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@xxxxxxxxxxxx> --- The documentation seems to require at least one pathname, and other git commands seem to insist on pathname lists not being empty. Add a similar test to git-check-attr. If it is considered likely that people depend on the current behavior, I have no problem with skipping this patch. builtin/check-attr.c | 9 +++++++-- t/t0003-attributes.sh | 2 ++ 2 files changed, 9 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++) { diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index f1debeb..2254005 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -46,6 +46,8 @@ test_expect_success 'command line checks' ' 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 && -- 1.7.6.8.gd2879 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html