Re: [PATCH v3 16/44] refs.c: move ref iterators to the common code

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

 



On 10/12/2015 11:51 PM, David Turner wrote:
> From: Ronnie Sahlberg <sahlberg@xxxxxxxxxx>
> 
> Signed-off-by: Ronnie Sahlberg <sahlberg@xxxxxxxxxx>
> ---
>  refs-be-files.c | 82 ---------------------------------------------------------
>  refs.c          | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 81 insertions(+), 82 deletions(-)
> 
> diff --git a/refs-be-files.c b/refs-be-files.c
> index ecf2b33..46fa43c 100644
> --- a/refs-be-files.c
> +++ b/refs-be-files.c
> [...]
> @@ -2012,40 +1964,6 @@ int for_each_namespaced_ref(each_ref_fn fn, void *cb_data)
>  	return ret;
>  }
>  
> -int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
> -	const char *prefix, void *cb_data)
> -{
> -	struct strbuf real_pattern = STRBUF_INIT;
> -	struct ref_filter filter;
> -	int ret;
> -
> -	if (!prefix && !starts_with(pattern, "refs/"))
> -		strbuf_addstr(&real_pattern, "refs/");
> -	else if (prefix)
> -		strbuf_addstr(&real_pattern, prefix);
> -	strbuf_addstr(&real_pattern, pattern);
> -
> -	if (!has_glob_specials(pattern)) {
> -		/* Append implied '/' '*' if not present. */
> -		strbuf_complete(&real_pattern, '/');
> -		/* No need to check for '*', there is none. */
> -		strbuf_addch(&real_pattern, '*');
> -	}
> -
> -	filter.pattern = real_pattern.buf;
> -	filter.fn = fn;
> -	filter.cb_data = cb_data;
> -	ret = for_each_ref(filter_refs, &filter);
> -
> -	strbuf_release(&real_pattern);
> -	return ret;
> -}
> -
> [...]
> diff --git a/refs.c b/refs.c
> index 44ee4f4..7714dad 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -781,3 +781,84 @@ const char *prettify_refname(const char *name)
>  		starts_with(name, "refs/remotes/") ? 13 :
>  		0);
>  }
> [...]
> +int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
> +	const char *prefix, void *cb_data)
> +{
> +	struct strbuf real_pattern = STRBUF_INIT;
> +	struct ref_filter filter;
> +	int ret;
> +
> +	if (!prefix && !starts_with(pattern, "refs/"))
> +		strbuf_addstr(&real_pattern, "refs/");
> +	else if (prefix)
> +		strbuf_addstr(&real_pattern, prefix);
> +	strbuf_addstr(&real_pattern, pattern);
> +
> +	if (!has_glob_specials(pattern)) {
> +		/* Append implied '/' '*' if not present. */
> +		if (real_pattern.buf[real_pattern.len - 1] != '/')
> +			strbuf_addch(&real_pattern, '/');

The original has

		strbuf_complete(&real_pattern, '/');

in place of the above two lines. I think you made a mistake when
rebasing on top of

    00b6c178c3 use strbuf_complete to conditionally append slash

> +		/* No need to check for '*', there is none. */
> +		strbuf_addch(&real_pattern, '*');
> +	}
> +
> +	filter.pattern = real_pattern.buf;
> +	filter.fn = fn;
> +	filter.cb_data = cb_data;
> +	ret = for_each_ref(filter_refs, &filter);
> +
> +	strbuf_release(&real_pattern);
> +	return ret;
> +}
> +
> [...]

Michael

-- 
Michael Haggerty
mhagger@xxxxxxxxxxxx

--
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]