add: don't complain when adding empty project root
This behavior was added in07d7bed
(add: don't complain when adding empty project root - 2009-04-28) then broken by84b8b5d
(remove match_pathspec() in favor of match_pathspec_depth() - 2013-07-14). Reinstate it. Noticed-by: Thomas Ferris Nicolaisen <tfnico@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d2446dfd7f
commit
64ed07cee0
@ -544,7 +544,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
|
||||
for (i = 0; i < pathspec.nr; i++) {
|
||||
const char *path = pathspec.items[i].match;
|
||||
if (!seen[i] &&
|
||||
if (!seen[i] && path[0] &&
|
||||
((pathspec.items[i].magic &
|
||||
(PATHSPEC_GLOB | PATHSPEC_ICASE)) ||
|
||||
!file_exists(path))) {
|
||||
|
Reference in New Issue
Block a user