Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-03-14 11:38:57 +0300
committerJunio C Hamano <junkio@cox.net>2007-03-14 11:38:57 +0300
commitc746e44fb8e7cf738177fee8d861defd4203af55 (patch)
treecd1629fe1dbe44d0006b7b2238f5f058859edf45
parentc379c4b176ce350a8d6c0773a3ad211996d809db (diff)
parent896bdfa2581f96d3df9a312510c39ce7d80790cd (diff)
Merge branch 'jb/per-user-exclude'
* jb/per-user-exclude: add: Support specifying an excludes file with a configuration variable
-rw-r--r--builtin-add.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/builtin-add.c b/builtin-add.c
index 87e16aa220..9fcf514dbc 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -12,6 +12,8 @@
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;
@@ -67,6 +69,8 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec)
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
@@ -88,6 +92,18 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec)
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[] =
@@ -115,7 +131,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
exit(1);
}
- git_config(git_default_config);
+ git_config(git_add_config);
newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1);