summaryrefslogtreecommitdiff
path: root/builtin-add.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-add.c')
-rw-r--r--builtin-add.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin-add.c b/builtin-add.c
index 4a91e3eb11..820110e085 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -228,6 +228,18 @@ int cmd_add(int argc, const char **argv, const char *prefix)
goto finish;
}
+ if (*argv) {
+ /* Was there an invalid path? */
+ if (pathspec) {
+ int num;
+ for (num = 0; pathspec[num]; num++)
+ ; /* just counting */
+ if (argc != num)
+ exit(1); /* error message already given */
+ } else
+ exit(1); /* error message already given */
+ }
+
fill_directory(&dir, pathspec, ignored_too);
if (show_only) {