Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:08

Jeff King [off-list ref] writes:
On Fri, Feb 24, 2012 at 03:48:10PM -0500, Jeff King wrote:
quoted
On Fri, Feb 24, 2012 at 12:03:17PM -0800, Junio C Hamano wrote:
quoted
quoted
-	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?
...
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.
I agree checking if dst is NULL makes a lot more sense than checking if
the src is NULL.

The reason I said "readability" macro was *NOT* because of these NULLs
looked unsightly.  I wanted the function name to tell "We are *NOT*
actually converting anything here at this point" to the readers.

I am perfectly fine to keep the source side of the parameters in the
readability macro, even if this partcular caller may have to spell NULL
and 0 there.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help