Skip to content

Commit 93b0d86

Browse files
author
Junio C Hamano
committed
git-add: error out when given no arguments.
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 5485115 commit 93b0d86

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

builtin-add.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ int cmd_add(int argc, const char **argv, const char *prefix)
111111
}
112112
usage(builtin_add_usage);
113113
}
114+
if (argc <= i) {
115+
fprintf(stderr, "Nothing specified, nothing added.\n");
116+
fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
117+
return 0;
118+
}
114119
pathspec = get_pathspec(prefix, argv + i);
115120

116121
fill_directory(&dir, pathspec);

0 commit comments

Comments
 (0)