From: Michael J Gruber <git@drmicha•warpmail.net>
To: Jeff King <peff@peff•net>
Cc: Junio C Hamano <gitster@pobox•com>,
Git Mailing List <git@vger•kernel.org>
Subject: Re: [RFC/PATCH 4/4] grep: obey --textconv for the case rev:path
Date: Thu, 07 Feb 2013 10:05:57 +0100 [thread overview]
Message-ID: <51136E75.5060002@drmicha.warpmail.net> (raw)
In-Reply-To: <20130206223656.GF27507@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 06.02.2013 23:36:
> On Wed, Feb 06, 2013 at 04:08:53PM +0100, Michael J Gruber wrote:
>
>> - add_object_array(object, arg, &list);
>> + add_object_array_with_context(object, arg, &list, xmemdupz(&oc, sizeof(struct object_context)));
>
> If we go this route, this new _with_context variant should be used in
> patch 1, too.
>
>> @@ -265,9 +260,28 @@ void add_object_array_with_mode(struct object *obj, const char *name, struct obj
>> objects[nr].item = obj;
>> objects[nr].name = name;
>> objects[nr].mode = mode;
>> + objects[nr].context = context;
>> array->nr = ++nr;
>> }
>
> This seems a little gross. Who is responsible for allocating the
> context? Who frees it? It looks like we duplicate it in cmd_grep. Which
Well, who is responsible for allocating and freeing name and item? I
didn't want to introduce a new member which is a struct when all other
complex members are pointers. Wouldn't that be confusing?
> I think is OK, but it means all of this context infrastructure in
> object.[ch] is just bolted-on junk waiting for somebody to use it wrong
> or get confused. It does not get set, for example, by the regular
> setup_revisions code path.
Sure, it's NULL when there is no context info, just like in many other
cases.
> It would be nice if we could just always have the context available,
> then setup_revisions could set it up by default (and replace the "mode"
> parameter entirely). But we'd need to do something to avoid the
> PATH_MAX-sized buffer for each entry, as some code paths may have a
> large number of pending objects.
If the information is always available even if we don't need it then it
always takes space. The only way out would be pointing into a pool of
path names rather having a copy in each entry. It's not like I hadn't
talked about providing virtual (blob) objects for path names keyed by
their sha1 before... It's just that I want my grep --textconv now ;)
Michael
next prev parent reply other threads:[~2013-02-07 9:06 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 15:27 [WIP/RFH/RFD/PATCH] grep: allow to use textconv filters Michael J Gruber
2013-02-04 17:12 ` Junio C Hamano
2013-02-05 8:48 ` Michael J Gruber
2013-02-05 11:13 ` Jeff King
2013-02-05 16:21 ` Michael J Gruber
2013-02-05 20:11 ` Jeff King
2013-02-06 15:08 ` [RFC/PATCH 0/4] textconv for show and grep Michael J Gruber
2013-02-06 15:08 ` [RFC/PATCH 1/4] show: obey --textconv for blobs Michael J Gruber
2013-02-06 16:53 ` Junio C Hamano
2013-02-06 22:12 ` Jeff King
2013-02-06 23:49 ` Junio C Hamano
2013-02-07 0:10 ` Jeff King
2013-02-07 0:26 ` Junio C Hamano
2013-02-07 8:48 ` Michael J Gruber
2013-02-06 22:06 ` Jeff King
2013-02-07 9:05 ` Michael J Gruber
2013-02-07 9:11 ` Jeff King
2013-02-07 9:34 ` Michael J Gruber
2013-02-07 9:43 ` Jeff King
2013-02-06 15:08 ` [RFC/PATCH 2/4] cat-file: do not die on --textconv without textconv filters Michael J Gruber
2013-02-06 16:47 ` Junio C Hamano
2013-02-06 22:19 ` Jeff King
2013-02-06 22:23 ` Junio C Hamano
2013-02-06 22:43 ` Jeff King
2013-02-06 15:08 ` [RFC/PATCH 3/4] grep: allow to use " Michael J Gruber
2013-02-06 15:12 ` Matthieu Moy
2013-02-06 22:23 ` Jeff King
2013-02-06 15:08 ` [RFC/PATCH 4/4] grep: obey --textconv for the case rev:path Michael J Gruber
2013-02-06 22:36 ` Jeff King
2013-02-07 9:05 ` Michael J Gruber [this message]
2013-02-07 9:26 ` Jeff King
2013-02-07 9:47 ` Michael J Gruber
2013-02-07 9:55 ` Jeff King
2013-02-07 10:31 ` Michael J Gruber
2013-02-07 18:03 ` Junio C Hamano
2013-02-08 11:27 ` Michael J Gruber
2013-02-06 16:55 ` [RFC/PATCH 0/4] textconv for show and grep Junio C Hamano
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=51136E75.5060002@drmicha.warpmail.net \
--to=git@drmicha$(echo .)warpmail.net \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=peff@peff$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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