git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Taylor Blau <me@ttaylorr.com>
Date
Sep 7, 2019, 23:16 UTC
Message-ID
<20190907231617.GA36491@syl.local>
In-Reply-To
<20190907213646.21231-1-ericdfreese@gmail.com>
Hi Eric,
On Sat, Sep 07, 2019 at 03:36:45PM -0600, Eric Freese wrote:
Show 16 quoted lines
> 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.

Show 14 quoted lines
> 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

Previous: Junio C Hamano
Message 13 of 13 in “for-each-ref: Add '--no-symbolic' option”
  1. 0/1 for-each-ref: Add '--no-symbolic' optionEric Freese, Sep 7, 2019
  2. 1/1 for-each-ref: add '--no-symbolic' optionEric Freese, Sep 7, 2019
  3. Taylor BlauSep 7, 2019
  4. Taylor BlauSep 7, 2019
  5. Jeff KingSep 8, 2019
  6. Taylor BlauSep 7, 2019
  7. Jeff KingSep 8, 2019
  8. Junio C HamanoSep 8, 2019
  9. Junio C HamanoSep 8, 2019
  10. Eric FreeseSep 9, 2019
  11. Jeff KingSep 9, 2019
  12. Junio C HamanoSep 9, 2019
  13. Taylor BlauSep 7, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.