diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index dc7eab89b34fed32dbb198a9aa9a7503fc162216..25dbfb44999566d0491b3f870a47f7df80aa7649 100644 (file)
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
pathspec = get_pathspec(prefix, argv + i);
/* Verify that the pathspec matches the prefix */
- if (pathspec)
+ if (pathspec) {
+ if (argc != i) {
+ int cnt;
+ for (cnt = 0; pathspec[cnt]; cnt++)
+ ;
+ if (cnt != (argc - i))
+ exit(1); /* error message already given */
+ }
prefix = verify_pathspec(prefix);
+ } else if (argc != i)
+ exit(1); /* error message already given */
/* Treat unmatching pathspec elements as errors */
if (pathspec && error_unmatch) {