aboutsummaryrefslogtreecommitdiff
path: root/builtin/clean.c
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2013-01-16 13:25:58 +0000
committerJunio C Hamano <gitster@pobox.com>2013-01-16 09:43:35 -0800
commit72aeb18772deeb386da7dd8997b969877bd29e41 (patch)
tree519f4e6cffd2fbfe1669b2ee203772764e18602d /builtin/clean.c
parent6f53feac95f35d470789348c051f6cee93449642 (diff)
downloadgit-72aeb18772deeb386da7dd8997b969877bd29e41.tar.gz
git-72aeb18772deeb386da7dd8997b969877bd29e41.tar.xz
clean.c, ls-files.c: respect encapsulation of exclude_list_groups
Consumers of the dir.c traversal API should avoid assuming knowledge of the internal implementation of exclude_list_groups. Therefore when adding items to an exclude list, it should be accessed via the pointer returned from add_exclude_list(), rather than by referencing a location within dir.exclude_list_groups[EXC_CMDL]. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clean.c')
-rw-r--r--builtin/clean.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/clean.c b/builtin/clean.c
index b098288ad..b9cb7ad4e 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -45,6 +45,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
static const char **pathspec;
struct strbuf buf = STRBUF_INIT;
struct string_list exclude_list = STRING_LIST_INIT_NODUP;
+ struct exclude_list *el;
const char *qname;
char *seen = NULL;
struct option options[] = {
@@ -97,10 +98,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
if (!ignored)
setup_standard_excludes(&dir);
- add_exclude_list(&dir, EXC_CMDL, "--exclude option");
+ el = add_exclude_list(&dir, EXC_CMDL, "--exclude option");
for (i = 0; i < exclude_list.nr; i++)
- add_exclude(exclude_list.items[i].string, "", 0,
- &dir.exclude_list_group[EXC_CMDL].el[0], -(i+1));
+ add_exclude(exclude_list.items[i].string, "", 0, el, -(i+1));
pathspec = get_pathspec(prefix, argv);