Code

git-add: error out when given no arguments.
authorJunio C Hamano <junkio@cox.net>
Wed, 20 Dec 2006 21:06:46 +0000 (13:06 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 20 Dec 2006 21:41:00 +0000 (13:41 -0800)
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-add.c

index c8a114fefb60a106dccffda5c703f2f00fa30ce9..f306f82b16c3c3c76416610cd4cabf0a307924ed 100644 (file)
@@ -111,6 +111,11 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                }
                usage(builtin_add_usage);
        }
+       if (argc <= i) {
+               fprintf(stderr, "Nothing specified, nothing added.\n");
+               fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
+               return 0;
+       }
        pathspec = get_pathspec(prefix, argv + i);
 
        fill_directory(&dir, pathspec);