Git development
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Chris Jerdonek <chris.jerdonek@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: question re: git show-ref and matching ref patterns from the front
Date: Sun, 11 Apr 2021 01:54:43 +0000	[thread overview]
Message-ID: <YHJW4xCgw6GN0Rag@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CAOTb1wef2w_H4mwMMwR4En8665GduAMoceL45+OYC4DSBPtozQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

On 2021-04-11 at 01:24:57, Chris Jerdonek wrote:
> Hi, I noticed that git-show-ref only seems to permit matching patterns
> from the end of a ref name:
> https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt-ltpatterngt82308203
> For example, "git show-ref master" will include both
> "refs/heads/master" and "refs/remotes/origin/master".
> 
> However, is there a way to limit Git to showing refs starting with a
> prefix, and that doesn't also require Git to iterate over all refs?
> 
> It seems like that would be natural and useful e.g. for repos with
> many refs and/or repos with namespaces. Am I missing something, or
> would that be a useful addition?

I believe you can do this with git for-each-ref.  It accepts prefixes,
and assuming you don't use a case-insensitive comparison, it will
restrict itself to iterating over only those prefixes you specify, not
all refs.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2021-04-11  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11  1:24 question re: git show-ref and matching ref patterns from the front Chris Jerdonek
2021-04-11  1:54 ` brian m. carlson [this message]
2021-04-11  2:09   ` Chris Jerdonek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHJW4xCgw6GN0Rag@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=chris.jerdonek@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox