From: Junio C Hamano <gitster@pobox.com>
To: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, vdye@github.com, me@ttaylorr.com,
mjcheetham@outlook.com, Derrick Stolee <derrickstolee@github.com>
Subject: Re: [PATCH 2/2] for-each-ref: add --count-matches option
Date: Mon, 26 Jun 2023 09:14:48 -0700 [thread overview]
Message-ID: <xmqqbkh25hfr.fsf@gitster.g> (raw)
In-Reply-To: <9121e027fb9f157878a9624ce6c834b69cd38472.1687792197.git.gitgitgadget@gmail.com> (Derrick Stolee via GitGitGadget's message of "Mon, 26 Jun 2023 15:09:57 +0000")
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> Each of these approaches is wasteful as it requires sending the list of
> matching reference names across a pipe plus the cost of parsing that
> output.
>
> Instead, it would be helpful to have a Git command that counts the
> number of refs matching a list of patterns.
For for-each-ref (which can be reused by branch and tag for no
cost), I am on the fence but slightly in favor (partly because the
code has already been written). But I have to wonder where changes
that come from the above reasoning need to end, though.
Do we count branches and tags because "git branch --list | wc -l" is
too costly? Should we teach "git remote" the same trick? How about
"git stash list"? "git show-index $pack_index"? "git ls-files"?
How do we decide where to draw the line? When a command invocation
in a large repository can produce records exceeding a million?
next prev parent reply other threads:[~2023-06-26 16:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 15:09 [PATCH 0/2] [RFC] for-each-ref: add --count-matches mode Derrick Stolee via GitGitGadget
2023-06-26 15:09 ` [PATCH 1/2] for-each-ref: extract ref output loop Derrick Stolee via GitGitGadget
2023-06-26 15:09 ` [PATCH 2/2] for-each-ref: add --count-matches option Derrick Stolee via GitGitGadget
2023-06-26 16:14 ` Junio C Hamano [this message]
2023-06-27 7:30 ` Jeff King
2023-06-27 10:05 ` Phillip Wood
2023-06-27 18:22 ` Junio C Hamano
2023-06-27 19:59 ` Jeff King
2023-06-28 13:12 ` Phillip Wood
2023-06-28 17:08 ` Junio C Hamano
2023-07-11 14:48 ` René Scharfe
2023-07-10 16:51 ` Derrick Stolee
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=xmqqbkh25hfr.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=me@ttaylorr.com \
--cc=mjcheetham@outlook.com \
--cc=vdye@github.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.