summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bd1fc62)
raw | patch | inline | side by side (parent: bd1fc62)
author | James Bowes <jbowes@dangerouslyinc.com> | |
Wed, 28 Feb 2007 03:31:10 +0000 (22:31 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 9 Mar 2007 08:06:00 +0000 (00:06 -0800) |
This adds the 'core.excludesfile' configuration variable. This variable can
hold a path to a file containing patterns of file names to exclude from
git-add, like $GIT_DIR/info/exclude. Patterns in the excludes file are used
in addition to those in info/exclude.
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
hold a path to a file containing patterns of file names to exclude from
git-add, like $GIT_DIR/info/exclude. Patterns in the excludes file are used
in addition to those in info/exclude.
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-add.c | patch | blob | history |
diff --git a/builtin-add.c b/builtin-add.c
index 87e16aa2200f90e2f12673e856040ed29ee7d119..9fcf514dbc4cb76e15b47142e77c4019997ecd5d 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
static const char builtin_add_usage[] =
"git-add [-n] [-v] [-f] [--interactive | -i] [--] <filepattern>...";
+static const char *excludes_file;
+
static void prune_directory(struct dir_struct *dir, const char **pathspec, int prefix)
{
char *seen;
path = git_path("info/exclude");
if (!access(path, R_OK))
add_excludes_from_file(dir, path);
+ if (!access(excludes_file, R_OK))
+ add_excludes_from_file(dir, excludes_file);
/*
* Calculate common prefix for the pathspec, and
prune_directory(dir, pathspec, baselen);
}
+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);
+}
+
static struct lock_file lock_file;
static const char ignore_warning[] =
exit(1);
}
- git_config(git_default_config);
+ git_config(git_add_config);
newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1);