Johannes Schindelin <johannes.schinde...@gmx.de> writes:

> Subject: Re: [PATCH v2 2/3] for-each-ref: let upstream/push optionally remote 
> ref name

No verb?  s/optionally/report/ perhaps?

> diff --git a/ref-filter.c b/ref-filter.c
> index 4819707d032..b4b2c9b2190 100644
> --- a/ref-filter.c
> +++ b/ref-filter.c
> @@ -77,7 +77,7 @@ static struct used_atom {
>               struct align align;
>               struct {
>                       enum {
> -                             RR_REF, RR_TRACK, RR_TRACKSHORT, RR_REMOTE_NAME
> +                             RR_REF, RR_TRACK, RR_TRACKSHORT, 
> RR_REMOTE_NAME, RR_REMOTE_REF
>                       } option;
>                       struct refname_atom refname;
>                       unsigned int nobracket : 1, push : 1, push_remote : 1;
> @@ -164,6 +164,9 @@ static void remote_ref_atom_parser(const struct 
> ref_format *format, struct used_
>               else if (!strcmp(s, "remotename")) {
>                       atom->u.remote_ref.option = RR_REMOTE_NAME;
>                       atom->u.remote_ref.push_remote = 1;
> +             } else if (!strcmp(s, "remoteref")) {
> +                     atom->u.remote_ref.option = RR_REMOTE_REF;
> +                     atom->u.remote_ref.push_remote = 1;
>               } else {
>                       atom->u.remote_ref.option = RR_REF;
>                       
> refname_atom_parser_internal(&atom->u.remote_ref.refname,
> @@ -1262,6 +1265,14 @@ static void fill_remote_ref_details(struct used_atom 
> *atom, const char *refname,
>                       *s = xstrdup(remote);
>               else
>                       *s = "";
> +     } else if (atom->u.remote_ref.option == RR_REMOTE_REF) {
> +             int explicit, for_push = starts_with(atom->name, "push");

Hmph, the previous step got rid of starts_with() rather nicely by
introducing atom->u.remote_ref.push bit; can't we do the same in
this step?

Other than that, looks nicer.

Thanks.

Reply via email to