]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-add.c
git branch: avoid unnecessary object lookups
[git.git] / builtin-add.c
index cb67d2c17e4017e8deede61b30c0eb7c8c60ac1e..d6ad57bfc2841959a2017d0723c1f9d57a920fac 100644 (file)
@@ -61,7 +61,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
        fill_pathspec_matches(pathspec, seen, specs);
 
        for (i = 0; i < specs; i++) {
-               if (!seen[i] && !file_exists(pathspec[i]))
+               if (!seen[i] && pathspec[i][0] && !file_exists(pathspec[i]))
                        die("pathspec '%s' did not match any files",
                                        pathspec[i]);
        }
@@ -250,6 +250,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
        int add_new_files;
        int require_pathspec;
 
+       git_config(add_config, NULL);
+
        argc = parse_options(argc, argv, builtin_add_options,
                          builtin_add_usage, 0);
        if (patch_interactive)
@@ -257,8 +259,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
        if (add_interactive)
                exit(interactive_add(argc, argv, prefix));
 
-       git_config(add_config, NULL);
-
        if (addremove && take_worktree_changes)
                die("-A and -u are mutually incompatible");
        if ((addremove || take_worktree_changes) && !argc) {