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:
authorAdam Spiers <git@adamspiers.org>2013-01-06 20:58:04 +0400
committerJunio C Hamano <gitster@pobox.com>2013-01-07 02:26:37 +0400
commitc04318e46aae79b8b8df059e2118519d83dfee12 (patch)
tree714436b653a34517e552024b0d1d2c9f94644997 /builtin/ls-files.c
parentc082df24539329c2e75395cf378f0a3fe187c028 (diff)
dir.c: keep track of where patterns came from
For exclude patterns read in from files, the filename is stored in the exclude list, and the originating line number is stored in the individual exclude (counting starting at 1). For exclude patterns provided on the command line, a string describing the source of the patterns is stored in the exclude list, and the sequence number assigned to each exclude pattern is negative, with counting starting at -1. So for example the 2nd pattern provided via --exclude would be numbered -2. This allows any future consumers of that data to easily distinguish between exclude patterns from files vs. from the CLI. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r--builtin/ls-files.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 0ca9d8e787..fa9ccb80dc 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -35,6 +35,7 @@ static int error_unmatch;
static char *ps_matched;
static const char *with_tree;
static int exc_given;
+static int exclude_args;
static const char *tag_cached = "";
static const char *tag_unmerged = "";
@@ -423,7 +424,7 @@ static int option_parse_exclude(const struct option *opt,
struct exclude_list_group *group = opt->value;
exc_given = 1;
- add_exclude(arg, "", 0, &group->el[0]);
+ add_exclude(arg, "", 0, &group->el[0], --exclude_args);
return 0;
}
@@ -524,7 +525,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
if (read_cache() < 0)
die("index file corrupt");
- add_exclude_list(&dir, EXC_CMDL);
+ add_exclude_list(&dir, EXC_CMDL, "--exclude option");
argc = parse_options(argc, argv, prefix, builtin_ls_files_options,
ls_files_usage, 0);
if (show_tag || show_valid_bit) {