OSDN Git Service

Merge branch 'nd/add-empty-fix'
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Jan 2014 18:33:03 +0000 (10:33 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Jan 2014 18:33:03 +0000 (10:33 -0800)
"git add -A" (no other arguments) in a totally empty working tree
used to emit an error.

* nd/add-empty-fix:
  add: don't complain when adding empty project root

1  2 
builtin/add.c

diff --cc builtin/add.c
@@@ -545,9 -544,7 +545,9 @@@ int cmd_add(int argc, const char **argv
  
                for (i = 0; i < pathspec.nr; i++) {
                        const char *path = pathspec.items[i].match;
-                       if (!seen[i] &&
 +                      if (pathspec.items[i].magic & PATHSPEC_EXCLUDE)
 +                              continue;
+                       if (!seen[i] && path[0] &&
                            ((pathspec.items[i].magic &
                              (PATHSPEC_GLOB | PATHSPEC_ICASE)) ||
                             !file_exists(path))) {