git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH 4/4] grep: obey --textconv for the case rev:path

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Feb 7, 2013, 09:05 UTC
Message-ID
<51136E75.5060002@drmicha.warpmail.net>
In-Reply-To
<20130206223656.GF27507@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 06.02.2013 23:36:
Show 18 quoted lines
> 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.

Show 5 quoted lines
> 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
Previous: Jeff KingNext: Jeff King
Message 31 of 37 in “grep: allow to use textconv filters”
  1. grep: allow to use textconv filtersMichael J Gruber, Feb 4, 2013
  2. Junio C HamanoFeb 4, 2013
  3. Michael J GruberFeb 5, 2013
  4. Jeff KingFeb 5, 2013
  5. Michael J GruberFeb 5, 2013
  6. Jeff KingFeb 5, 2013
  7. 0/4 textconv for show and grepMichael J Gruber, Feb 6, 2013
  8. Junio C HamanoFeb 6, 2013
  9. 1/4 show: obey --textconv for blobsMichael J Gruber, Feb 6, 2013
  10. Junio C HamanoFeb 6, 2013
  11. Jeff KingFeb 6, 2013
  12. Junio C HamanoFeb 6, 2013
  13. Jeff KingFeb 7, 2013
  14. Junio C HamanoFeb 7, 2013
  15. Michael J GruberFeb 7, 2013
  16. Jeff KingFeb 6, 2013
  17. Michael J GruberFeb 7, 2013
  18. Jeff KingFeb 7, 2013
  19. Michael J GruberFeb 7, 2013
  20. Jeff KingFeb 7, 2013
  21. 2/4 cat-file: do not die on --textconv without textconv filtersMichael J Gruber, Feb 6, 2013
  22. Junio C HamanoFeb 6, 2013
  23. Jeff KingFeb 6, 2013
  24. Junio C HamanoFeb 6, 2013
  25. Jeff KingFeb 6, 2013
  26. 3/4 grep: allow to use textconv filtersMichael J Gruber, Feb 6, 2013
  27. Matthieu MoyFeb 6, 2013
  28. Jeff KingFeb 6, 2013
  29. 4/4 grep: obey --textconv for the case rev:pathMichael J Gruber, Feb 6, 2013
  30. Jeff KingFeb 6, 2013
  31. Michael J GruberFeb 7, 2013
  32. Jeff KingFeb 7, 2013
  33. Michael J GruberFeb 7, 2013
  34. Jeff KingFeb 7, 2013
  35. Michael J GruberFeb 7, 2013
  36. Junio C HamanoFeb 7, 2013
  37. Michael J GruberFeb 8, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.