Subject: Re: [RFC PATCH 0/1] for-each-ref: Add '--no-symbolic' option

From: Taylor Blau <[email-masked]>
Date: Sat, 7 Sep 2019 19:16:17 -0400

Hi Eric,

On Sat, Sep 07, 2019 at 03:36:45PM -0600, Eric Freese wrote:
> Hi,
>
> I was recently using git-for-each-ref in a script to get a list of
> remote refs that pointed at a particular commit so that they could
> automatically be updated and pushed back to that remote. This fails when
> it comes across refs/remotes/origin/HEAD, which is a symbolic link.
>
> I was able to solve the problem with:
>
> ```
> git for-each-ref ... --format="%(refname) %(symref)" | grep " $"
> ```
>
> But that feels a little clumsy to me. I would have expected there to be
> a flag like `--no-symbolic` that would exclude symbolic refs from the
> output. So I went ahead and added it :)

Indeed, that does seem a little clumsy to me, too. It's kind of a great
hack, but I could foresee functionality like '--no-symbolic' to be
useful to avoid hackery like this.

> I could forsee this option also being added to git-branch and git-tag,
> but decided to keep it to git-for-each-ref to test the waters before
> investing any further time into it.

Yep. It's good that your patches are mainly in the 'ref-filter.[ch]'
code, so it would be easy to wire up new flags in both the branch+tag
builtins, too, since they use the same ref-filter API.

> Cheers
>
> Eric Freese (1):
>   for-each-ref: add '--no-symbolic' option
>
>  Documentation/git-for-each-ref.txt | 3 +++
>  builtin/for-each-ref.c             | 4 +++-
>  ref-filter.c                       | 4 ++++
>  ref-filter.h                       | 3 ++-
>  t/t6302-for-each-ref-filter.sh     | 6 ++++++
>  5 files changed, 18 insertions(+), 2 deletions(-)
>
> --
> 2.23.0

Thanks,
Taylor