]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/add.c
pathspec: support :(glob) syntax
[thirdparty/git.git] / builtin / add.c
index 663ddd122cca1da02d891b85400d0819d13a9ca8..1dab2464f6bd4c848b3068c3e12df378b0540197 100644 (file)
@@ -541,11 +541,16 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                /*
                 * file_exists() assumes exact match
                 */
-               GUARD_PATHSPEC(&pathspec, PATHSPEC_FROMTOP | PATHSPEC_LITERAL);
+               GUARD_PATHSPEC(&pathspec,
+                              PATHSPEC_FROMTOP |
+                              PATHSPEC_LITERAL |
+                              PATHSPEC_GLOB);
 
                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) ||
+                            !file_exists(path))) {
                                if (ignore_missing) {
                                        int dtype = DT_UNKNOWN;
                                        if (is_excluded(&dir, path, &dtype))