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

Re: [PATCH 2/2] do not stream large files to pack when filters are in use

From
Jeff King <peff@peff.net>
Date
Feb 24, 2012, 21:01 UTC
Message-ID
<20120224210134.GA22177@sigill.intra.peff.net>
In-Reply-To
<20120224204810.GC21447@sigill.intra.peff.net>
On Fri, Feb 24, 2012 at 03:48:10PM -0500, Jeff King wrote:
Show 15 quoted lines
> On Fri, Feb 24, 2012 at 12:03:17PM -0800, Junio C Hamano wrote:
> 
> > > -	else if (size <= big_file_threshold || type != OBJ_BLOB)
> > > +	else if (size <= big_file_threshold || type != OBJ_BLOB ||
> > > +		 convert_to_git(path, NULL, 0, NULL, 0))
> > 
> > Nice.  It would be even nicer to give a readability macro whose name makes
> > it clear that this is a query (unfortunately we cannot add '?' at the end
> > of the function name) and not a conversion.  Any name suggestions?
> 
> Yeah, I cringed a little at all of the NULLs. How about:
> 
>   int would_convert_to_git(const char *path);
> 
> ?

I started to do this but had a thought: would other callers want more flexibility? That is, should convert_to_git's dry run trigger actually be: the _destination_ buffer is NULL?

I.e., you could call it like this:
  convert_to_git(path, buf, len, NULL, 0);

and find out the real answer, including inspecting buf, about whether we would convert. Or you could also use a NULL buffer to get the pessimistic "we might convert" case.

I don't think it really matters that much, as I am introducing only one caller. I'm not sure if any other code paths would care about this speculative "maybe we would convert" question, so perhaps it is simply over-engineering.

-Peff
Previous: Jeff KingNext: Junio C Hamano
Message 12 of 19 in “[BUG?] bulk checkin does not respect filters”
  1. Jeff KingFeb 24, 2012
  2. Junio C HamanoFeb 24, 2012
  3. Junio C HamanoFeb 24, 2012
  4. Jeff KingFeb 24, 2012
  5. Junio C HamanoFeb 24, 2012
  6. Jeff KingFeb 24, 2012
  7. Jeff KingFeb 24, 2012
  8. 1/2 teach convert_to_git a "dry run" modeJeff King, Feb 24, 2012
  9. 2/2 do not stream large files to pack when filters are in useJeff King, Feb 24, 2012
  10. Junio C HamanoFeb 24, 2012
  11. Jeff KingFeb 24, 2012
  12. Jeff KingFeb 24, 2012
  13. Junio C HamanoFeb 24, 2012
  14. Jeff KingFeb 24, 2012
  15. 1/3 teach convert_to_git a "dry run" modeJeff King, Feb 24, 2012
  16. 2/3 teach dry-run convert_to_git not to require a src bufferJeff King, Feb 24, 2012
  17. 3/3 do not stream large files to pack when filters are in useJeff King, Feb 24, 2012
  18. Junio C HamanoFeb 24, 2012
  19. Junio C HamanoFeb 24, 2012

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.