X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-add.c;h=4fc9d6f7ccdd7b989d75ae6e24df997c4deb3505;hb=10455d2a955a29db1809be139177e4e298771eb0;hp=3d8b8b4f89514e0a8f7af1c2c7dc2f8ae372129e;hpb=9269df96105dff5ecc137b598ac7664d218ac6be;p=git.git diff --git a/builtin-add.c b/builtin-add.c index 3d8b8b4f8..4fc9d6f7c 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -17,7 +17,6 @@ static const char builtin_add_usage[] = "git-add [-n] [-v] [-f] [--interactive | -i] [-u] [--refresh] [--] ..."; static int take_worktree_changes; -static const char *excludes_file; static void prune_directory(struct dir_struct *dir, const char **pathspec, int prefix) { @@ -44,6 +43,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p die("pathspec '%s' did not match any files", pathspec[i]); } + free(seen); } static void fill_directory(struct dir_struct *dir, const char **pathspec, @@ -56,12 +56,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec, memset(dir, 0, sizeof(*dir)); if (!ignored_too) { dir->collect_ignored = 1; - dir->exclude_per_dir = ".gitignore"; - path = git_path("info/exclude"); - if (!access(path, R_OK)) - add_excludes_from_file(dir, path); - if (excludes_file != NULL && !access(excludes_file, R_OK)) - add_excludes_from_file(dir, excludes_file); + setup_standard_excludes(dir); } /* @@ -122,7 +117,7 @@ static void update(int verbose, const char *prefix, const char **files) rev.diffopt.format_callback_data = &verbose; if (read_cache() < 0) die("index file corrupt"); - run_diff_files(&rev, 0); + run_diff_files(&rev, DIFF_RACY_IS_MODIFIED); } static void refresh(int verbose, const char **pathspec) @@ -140,18 +135,7 @@ static void refresh(int verbose, const char **pathspec) if (!seen[i]) die("pathspec '%s' did not match any files", pathspec[i]); } -} - -static int git_add_config(const char *var, const char *value) -{ - if (!strcmp(var, "core.excludesfile")) { - if (!value) - die("core.excludesfile without value"); - excludes_file = xstrdup(value); - return 0; - } - - return git_default_config(var, value); + free(seen); } static struct lock_file lock_file; @@ -181,7 +165,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) exit(1); } - git_config(git_add_config); + git_config(git_default_config); newfd = hold_locked_index(&lock_file, 1);