Code

Teach git-fetch to grab a tag at the same time as a commit
[git.git] / builtin-add.c
index 4a91e3eb118850882fbc22e8d8f37e8bbfaa7617..820110e085f20d8615c74167cf3ae4cfd1fe6912 100644 (file)
@@ -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) {