Adam Spiers <g...@adamspiers.org> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to