Re: [PATCH 4/4] builtin/remote: only iterate through refs that are to be renamed

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

 



Patrick Steinhardt <ps@xxxxxx> writes:

[snip]

> diff --git a/refs.c b/refs.c
> index b820c3908bd..861a0deb924 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1840,7 +1840,13 @@ int refs_for_each_namespaced_ref(struct ref_store *refs,
>
>  int refs_for_each_rawref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
>  {
> -	return do_for_each_ref(refs, "", NULL, fn, 0,
> +	return refs_for_each_rawref_in(refs, "", fn, cb_data);
> +}
> +
> +int refs_for_each_rawref_in(struct ref_store *refs, const char *prefix,
> +			    each_ref_fn fn, void *cb_data)
> +{
> +	return do_for_each_ref(refs, prefix, NULL, fn, 0,
>  			       DO_FOR_EACH_INCLUDE_BROKEN, cb_data);
>  }
>
> diff --git a/refs.h b/refs.h
> index a39f873b1fe..9decd3126e3 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -428,6 +428,8 @@ int refs_for_each_namespaced_ref(struct ref_store *refs,
>
>  /* can be used to learn about broken ref and symref */
>  int refs_for_each_rawref(struct ref_store *refs, each_ref_fn fn, void *cb_data);
> +int refs_for_each_rawref_in(struct ref_store *refs, const char *prefix,
> +			    each_ref_fn fn, void *cb_data);
>
>  /*
>   * Iterates over all refs including root refs, i.e. pseudorefs and HEAD.
>
> --
> 2.50.1.565.gc32cd1483b.dirty

Nit: we do expose the reference iterators now with
'kn/for-each-ref-skip' (merged to next). We could directly use the
iterator instead of introducting a specific function like this.

- Karthik

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux