Re: [PATCH 14/19] Convert ce_path_match() use to match_pathspec()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> writes:

> Previously ce_path_match() is used together with tree_entry_interesting().
> Both do not support wildcards. tree_entry_interesting() understands
> wildcards now, so it's time to teach ce_path_match() to do the same.
>
> Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>
> ---

This function is called from both Porcelains (e.g. "git diff" via
diff-lib.c and "git status" via wt-status.c) and plumbing commands
(e.g. "git update-index"), and we are changing the semantics in a big way,
even though it is a huge improvement.

I am fairly excited with the progress of this series.  When it gets merged
to 'master', we will be declaring 1.8.0 ;-)

I imagine that eventually ce_path_match() will also take "struct pathspec *"
not "const char **" when the series is completed, yes?  Or there is no
real need for that?

>  read-cache.c |   20 +-------------------
>  1 files changed, 1 insertions(+), 19 deletions(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index 1f42473..cbabd8b 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -685,28 +685,10 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b)
>  
>  int ce_path_match(const struct cache_entry *ce, const char **pathspec)
>  {
> -	const char *match, *name;
> -	int len;
> -
>  	if (!pathspec)
>  		return 1;
>  
> -	len = ce_namelen(ce);
> -	name = ce->name;
> -	while ((match = *pathspec++) != NULL) {
> -		int matchlen = strlen(match);
> -		if (matchlen > len)
> -			continue;
> -		if (memcmp(name, match, matchlen))
> -			continue;
> -		if (matchlen && name[matchlen-1] == '/')
> -			return 1;
> -		if (name[matchlen] == '/' || !name[matchlen])
> -			return 1;
> -		if (!matchlen)
> -			return 1;
> -	}
> -	return 0;
> +	return match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, NULL);
>  }
>  
>  /*
> -- 
> 1.7.3.3.476.g10a82
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]