From: Junio C Hamano Date: Sun, 06 Jan 2013 23:19:15 GMT Subject: Re: [PATCH v3 11/19] dir.c: use a single struct exclude_list per source of excludes Message-ID: <7v1udxnbm4.fsf@alter.siamese.dyndns.org> In-Reply-To: <20130106225311.GB6552@pacific.linksys.moosehall> Adam Spiers writes: > That's a valid point. However, the ary[0] part which assumes external > knowledge of the internal implementation can trivially be avoided by > squashing this patch onto the commit we are discussing: > > diff --git a/builtin/clean.c b/builtin/clean.c > index dd89737..6e21ca6 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); > + el = add_exclude_list(&dir, EXC_CMDL); > for (i = 0; i < exclude_list.nr; i++) > - add_exclude(exclude_list.items[i].string, "", 0, > - &dir.exclude_list_group[EXC_CMDL].el[0]); > + add_exclude(exclude_list.items[i].string, "", 0, el); > > pathspec = get_pathspec(prefix, argv); > > > and by adopting the same approach for ls-files.c: That is _much_ more readable and easier to explain in the API documentation, I think. Thanks.