Merge branch 'wk/submodule-on-branch'
[gitweb.git] / builtin / add.c
index 0df73ae73596546966af18e7076d9a6f54964786..672adc01ffc07fa97c305f9110cfa3995658b922 100644 (file)
@@ -208,8 +208,7 @@ static char *prune_directory(struct dir_struct *dir, struct pathspec *pathspec,
        i = dir->nr;
        while (--i >= 0) {
                struct dir_entry *entry = *src++;
-               if (match_pathspec_depth(pathspec, entry->name, entry->len,
-                                        prefix, seen))
+               if (dir_path_match(entry, pathspec, prefix, seen))
                        *dst++ = entry;
                else if (flag & WARN_IMPLICIT_DOT)
                        /*
@@ -547,7 +546,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                        const char *path = pathspec.items[i].match;
                        if (pathspec.items[i].magic & PATHSPEC_EXCLUDE)
                                continue;
-                       if (!seen[i] &&
+                       if (!seen[i] && path[0] &&
                            ((pathspec.items[i].magic &
                              (PATHSPEC_GLOB | PATHSPEC_ICASE)) ||
                             !file_exists(path))) {