From: Jeff King <peff@peff.net>
To: Harald Nordgren <haraldnordgren@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH v8] ls-remote: create '--sort' option
Date: Fri, 6 Apr 2018 14:58:01 -0400 [thread overview]
Message-ID: <20180406185801.GA921@sigill.intra.peff.net> (raw)
In-Reply-To: <CAHwyqnU4jv=wW_no4ff_E2TgvGtga1GOhZoDKd93J5MMUtLFCA@mail.gmail.com>
On Thu, Apr 05, 2018 at 01:11:34AM +0200, Harald Nordgren wrote:
> Without digging to much into the `ref-filter` code itself, it seems
> like there is an opportunity to generalize and unfify the logic
> between these two cases. As well as using `ALLOC_GROW`. But maybe that
> is best left as a follow-up task? Especially since this patch focuses
> on `ls-remote`. Seems possibly like too big of a change to start
> changing a different sub-command.
Yes and no. By refactoring we have the potential to regress another
unrelated command. But by not refactoring, we set up a potential misuse
of the other interface which may lead to more bugs down the road.
I think an important thing is to split out the refactoring steps into
their own patches, so it's easy to see that they're not hurting the
existing uses. I have some sample patches, which I'll send in a moment.
> Wouldn't a `ref_array_push()` also require `ref->symref`, maybe then
> we could pass the whole ref? It needs to be very clear that it's a
> `ref` and not a `ref_array_item` that is being pushed. Much of my
> logic here deals specifically with trying to treat a ref as
> ref_array_item.
I think it would be OK to have the push operation return the actual
item, which can then be filled in more. That's how the internal
ref-filter code does it already.
> From my viewpoint as implementer, I was very happy that I could
> implement the feature *without* invoking `filter_refs` since that
> `filter->kind` switching looks a pretty daunting. I'm not exactly sure
> what a `git ls-remote --contains HEAD` would do, maybe you could
> explain a bit more?
I agree it would be a bit larger of a retro-fit to adapt filter_refs()
for our purpose here. And since we're not doing any filtering at this
point, there's not much benefit.
Here are the refactoring patches I came up with. I think they're a
benefit to ref-filter on their own, and then it should be pretty easy
for you to build your patch on top.
[1/3]: ref-filter: use "struct object_id" consistently
[2/3]: ref-filter: make ref_array_item allocation more consistent
[3/3]: ref-filter: factor ref_array pushing into its own function
builtin/tag.c | 2 +-
builtin/verify-tag.c | 2 +-
ref-filter.c | 36 +++++++++++++++++++++++++-----------
ref-filter.h | 10 +++++++++-
4 files changed, 36 insertions(+), 14 deletions(-)
-Peff
PS I'm going to be offline for a few weeks starting tomorrow, so I won't
be responsive to this thread. :) If you like the direction, please
feel free to pick up those patches, rebase yours on top, and then
send them all out as a series.
In case it's easier than applying from the list, you can fetch them
from the "jk/ref-array-push" branch of https://github.com/peff/git.
next prev parent reply other threads:[~2018-04-06 18:58 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 0:52 [PATCH] ls-remote: create option to sort by versions Harald Nordgren
2018-04-02 6:37 ` Ævar Arnfjörð Bjarmason
2018-04-02 16:26 ` Harald Nordgren
2018-04-02 17:32 ` Ævar Arnfjörð Bjarmason
2018-04-02 17:42 ` Harald Nordgren
2018-04-02 17:46 ` Jeff King
2018-04-02 18:32 ` Junio C Hamano
2018-04-02 20:03 ` Harald Nordgren
2018-04-02 22:11 ` [PATCH v5] ls-remote: create '--sort' option Harald Nordgren
2018-04-02 22:53 ` Eric Sunshine
2018-04-02 22:54 ` Eric Sunshine
2018-04-03 0:48 ` [PATCH v6] " Harald Nordgren
2018-04-02 21:05 ` [PATCH v4] " Harald Nordgren
2018-04-04 17:11 ` [PATCH v7] " Harald Nordgren
2018-04-04 17:18 ` Harald Nordgren
2018-04-04 17:47 ` Harald Nordgren
2018-04-04 18:56 ` Jeff King
2018-04-04 18:55 ` Jeff King
2018-04-04 23:01 ` [PATCH v8] " Harald Nordgren
2018-04-04 23:11 ` Harald Nordgren
2018-04-06 18:58 ` Jeff King [this message]
2018-04-06 18:58 ` [PATCH 1/3] ref-filter: use "struct object_id" consistently Jeff King
2018-04-06 18:59 ` [PATCH 2/3] ref-filter: make ref_array_item allocation more consistent Jeff King
2018-04-06 18:59 ` [PATCH 3/3] ref-filter: factor ref_array pushing into its own function Jeff King
2018-04-06 19:27 ` Derrick Stolee
2018-04-07 15:22 ` Harald Nordgren
2018-04-08 23:18 ` Junio C Hamano
2018-04-09 3:57 ` Jeff King
2018-04-04 23:32 ` [PATCH v9] ls-remote: create '--sort' option Harald Nordgren
2018-04-05 0:04 ` [PATCH v10] " Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08 1:06 ` Eric Sunshine
2018-04-08 12:27 ` Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-08 1:48 ` Eric Sunshine
2018-04-08 12:28 ` [PATCH v12 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-08 22:16 ` Junio C Hamano
2018-04-09 0:09 ` Harald Nordgren
2018-04-09 0:48 ` Junio C Hamano
2018-04-09 2:31 ` Eric Sunshine
2018-04-08 23:58 ` [PATCH v13 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-09 0:56 ` Junio C Hamano
2018-04-09 1:45 ` Harald Nordgren
2018-04-09 1:42 ` [PATCH v14 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-09 1:42 ` [PATCH v14 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-11 17:57 ` Harald Nordgren
2018-04-11 18:07 ` Stefan Beller
2018-04-11 18:30 ` Todd Zullinger
2018-04-11 18:56 ` Eric Sunshine
2018-04-11 23:25 ` Junio C Hamano
2018-04-09 1:42 ` [PATCH v14 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-09 1:42 ` [PATCH v14 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-05-12 8:45 ` René Scharfe
2018-05-12 9:55 ` Jeff King
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=20180406185801.GA921@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=haraldnordgren@gmail.com \
--cc=sunshine@sunshineco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).