git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org, toon@iotcl.com
Subject: Re: [PATCH 2/2] attr: add flag `-r|--revisions` to work with revisions
Date: Wed, 07 Dec 2022 12:53:00 +0100	[thread overview]
Message-ID: <221207.86h6y7a0l7.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CAOLa=ZS5k=s98Bo9GE+RRa3jtanehL35y-hhLhy1DoM7GyO0cQ@mail.gmail.com>


On Wed, Dec 07 2022, Karthik Nayak wrote:

> On Wed, Dec 7, 2022 at 1:12 AM Junio C Hamano <gitster@pobox.com> wrote:
> [...]
>> Also, at the C API level, I suspect that we strongly prefer to pass
>> around either the "struct object_id *" or "struct tree *", not working
>> with end-user supplied character strings without any sanity-checking
>> or parsing.
>>
>
> I must admit, I did take the path of least resistance here. So we finally need
> to parse the `revision:<pathname>` where the `<pathname>` is generated
> dynamically as we move through the check-attr stack.
>
> My question is, if I generate an `object_id` at the start (in
> builtin/check-attr.c)
> with only the `revision`, is there a way to traverse to find the blob
> for each of
> the different <pathnames>? I haven't looked at Git code for a while now, and
> I'm not sure what the best way to do this. Maybe I've missed some API which
> would make this simple, any help is appreciated.

The get_oid() that you're doing now happens in a loop, and should be
pulled out of it.

I suggested making that a feature in
https://lore.kernel.org/git/221207.86lenja0zi.gmgdl@evledraar.gmail.com/;
but if you keep the interface you've got where you only support a single
<rev> it would make the most sense to do that get_oid() in the builtin/
code at the start, and then pass the oid/path pair down.

You'd still need to call read_object_file() or equivalent for each
<rev>:<path> pair though.

  reply	other threads:[~2022-12-07 11:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 10:37 [PATCH 0/2] check-attr: add support to work with revisions Karthik Nayak
2022-12-06 10:37 ` [PATCH 1/2] t0003: move setup for `--all` into new block Karthik Nayak
2022-12-06 10:37 ` [PATCH 2/2] attr: add flag `-r|--revisions` to work with revisions Karthik Nayak
2022-12-06 11:27   ` Ævar Arnfjörð Bjarmason
2022-12-06 13:06     ` Karthik Nayak
2022-12-07  0:12   ` Junio C Hamano
2022-12-07  1:10     ` Eric Sunshine
2022-12-07 11:05       ` Karthik Nayak
2022-12-07 11:38     ` Ævar Arnfjörð Bjarmason
2022-12-07 12:33       ` Karthik Nayak
2022-12-07 11:40     ` Karthik Nayak
2022-12-07 11:53       ` Ævar Arnfjörð Bjarmason [this message]
2022-12-07 12:29         ` Karthik Nayak
2022-12-06 11:20 ` [PATCH 0/2] check-attr: add support " Philip Oakley
2022-12-06 13:00   ` Karthik Nayak
2022-12-07  1:09 ` Taylor Blau
2022-12-07  2:11   ` brian m. carlson

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=221207.86h6y7a0l7.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karthik.188@gmail.com \
    --cc=toon@iotcl.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).