submodule.c: add .gitmodules staging helper functions
[gitweb.git] / builtin / add.c
index 0b80fa8956c8833bffced2f413fd834097c9ba50..9d52fc7915a5061a757ce937f24e894d65cb0dff 100644 (file)
@@ -541,11 +541,18 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                /*
                 * file_exists() assumes exact match
                 */
-               GUARD_PATHSPEC(&pathspec, PATHSPEC_FROMTOP);
+               GUARD_PATHSPEC(&pathspec,
+                              PATHSPEC_FROMTOP |
+                              PATHSPEC_LITERAL |
+                              PATHSPEC_GLOB |
+                              PATHSPEC_ICASE);
 
                for (i = 0; i < pathspec.nr; i++) {
                        const char *path = pathspec.items[i].match;
-                       if (!seen[i] && !file_exists(path)) {
+                       if (!seen[i] &&
+                           ((pathspec.items[i].magic &
+                             (PATHSPEC_GLOB | PATHSPEC_ICASE)) ||
+                            !file_exists(path))) {
                                if (ignore_missing) {
                                        int dtype = DT_UNKNOWN;
                                        if (is_excluded(&dir, path, &dtype))