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

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

From
Eric Freese <ericdfreese@gmail.com>
Date
Sep 9, 2019, 04:01 UTC
Message-ID
<CAAikoA+MvORDJ6y=VSk_1s6v7110UeOfU2X2G7=9ChV+m+COxQ@mail.gmail.com>
In-Reply-To
<xmqq4l1mmn8i.fsf@gitster-ct.c.googlers.com>
On Sun, Sep 9, 2019 at 4:34 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
> I guess with "%(if)...%(then)...%(else)...%(end)" you might be able
> to do either one of --include/--exclude without supporting the
> other, e.g. "--include='%(if)%(symref)%(then)%(else)not a
> symref%(end)" would be usable as "I do not want to see symrefs" in a
> system that supports only "--include" without "--exclude".
This has made me realize that I can get the behavior I need by using `%(if)`.
Exclude symrefs:
  "%(if)%(symref)%(then)%(else)%(refname)%(end)"
Only symrefs:
  "%(if)%(symref)%(then)%(refname)%(end)"

However, this still prints an empty line for each ref that does not match the condition. This can be cleaned up by piping through `grep .`, but what would you think of adding a new optional flag to git-for-each-ref to prevent it from printing empty expanded format strings?

Previous: Junio C HamanoNext: Jeff King
Message 10 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.