On Fri, Mar 15, 2013 at 01:06:38PM +0700, Nguyễn Thái Ngọc Duy wrote:
> check-ignore (at least the test suite) seems to rely on the pattern
> order. PATHSPEC_KEEP_ORDER is introduced to explictly express this.
> The lack of PATHSPEC_MAXDEPTH_VALID is sufficient because it's the
> only flag that reorders pathspecs, but it's less obvious that way.

Sorry for the slow response - I only just noticed this today.  (It
would be useful if any future patches to check-ignore Cc: me
explicitly, to catch my mail filters.)

> Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
> ---
>  builtin/check-ignore.c | 34 +++++++++++++++++++++-------------
>  pathspec.c             |  6 +++++-
>  pathspec.h             |  1 +
>  t/t0008-ignores.sh     |  8 ++++----
>  4 files changed, 31 insertions(+), 18 deletions(-)
> 
> diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
> index 0240f99..6e55f06 100644
> --- a/builtin/check-ignore.c
> +++ b/builtin/check-ignore.c
> @@ -53,14 +53,14 @@ static void output_exclude(const char *path, struct 
> exclude *exclude)
>       }
>  }
>  
> -static int check_ignore(const char *prefix, const char **pathspec)
> +static int check_ignore(int argc, const char **argv, const char *prefix)
>  {
>       struct dir_struct dir;
> -     const char *path, *full_path;
>       char *seen;
>       int num_ignored = 0, dtype = DT_UNKNOWN, i;
>       struct path_exclude_check check;
>       struct exclude *exclude;
> +     struct pathspec pathspec;
>  
>       /* read_cache() is only necessary so we can watch out for submodules. */
>       if (read_cache() < 0)
> @@ -70,31 +70,39 @@ static int check_ignore(const char *prefix, const char 
> **pathspec)
>       dir.flags |= DIR_COLLECT_IGNORED;
>       setup_standard_excludes(&dir);
>  
> -     if (!pathspec || !*pathspec) {
> +     if (!argc) {

Is there a compelling reason for introducing argc as a new parameter
to check_ignore(), other than simplifying the above line?  And why
rename the pathspec parameter to argv?  Both these changes are
misleading AFAICS, since paths provided to check_ignore() can come
from sources other than CLI arguments (i.e. via --stdin).  

The introduction of argc also makes it possible to invoke
check_ignore() with arguments which are not self-consistent.

I haven't been following your pathspec work, but FWIW the other
changes in this patch look reasonable at a glance.

Thanks,
Adam
--
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