diff --git a/src/builtin-add.c b/src/builtin-add.c index febb75e..a501b50 100644 --- a/src/builtin-add.c +++ b/src/builtin-add.c @@ -11,7 +11,7 @@ #include "cache-tree.h" static const char builtin_add_usage[] = -"git-add [-n] [-v] ..."; +"git-add [--exclude=] [-n] [-v] ..."; static void prune_directory(struct dir_struct *dir, const char **pathspec, int prefix) { @@ -55,7 +55,6 @@ static void fill_directory(struct dir_st int baselen; /* Set up the default git porcelain excludes */ - memset(dir, 0, sizeof(*dir)); dir->exclude_per_dir = ".gitignore"; path = git_path("info/exclude"); if (!access(path, R_OK)) @@ -90,6 +89,7 @@ int cmd_add(int argc, const char **argv, const char **pathspec; struct dir_struct dir; + memset(&dir, 0, sizeof(dir)); git_config(git_default_config); newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1); @@ -106,6 +106,10 @@ int cmd_add(int argc, const char **argv, i++; break; } + if (!strncmp(arg, "--exclude=", 10)) { + add_exclude(arg+10, "", 0, &dir.exclude_list[EXC_CMDL]); + continue; + } if (!strcmp(arg, "-n")) { show_only = 1; continue;