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

Re: Bug? Error during commit

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 14, 2018, 17:31 UTC
Message-ID
<xmqqsha3o4u7.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180210121607.GA21843@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> Here's the patch to make "show -B --stat" work. I'll give some more
> thought to whether this is a good idea and prepare a series.
>
> One downside is that in the common case it causes us to look up each
> object twice (once to get its size, and then again to load the content).
> I wonder if we should have a function for "read this object, unless it's
> over N bytes, in which case just tell me the size". That's weirdly
> specific, but I think pretty much every user of core.bigfilethreshold
> would want it.

After reading through "git grep" hits for the global variable, I think it makes sense to have such a helper with a good name without configurable N (just use big_file_threshold that is global). The user of the interface either punt on size like this caller, or would switch to the streaming interface.

Show 20 quoted lines
>
> ---
> diff --git a/diffcore-break.c b/diffcore-break.c
> index c64359f489..35f5b50bcc 100644
> --- a/diffcore-break.c
> +++ b/diffcore-break.c
> @@ -61,6 +61,13 @@ static int should_break(struct diff_filespec *src,
>  	    !oidcmp(&src->oid, &dst->oid))
>  		return 0; /* they are the same */
>  
> +	if (diff_populate_filespec(src, CHECK_SIZE_ONLY) ||
> +	    diff_populate_filespec(dst, CHECK_SIZE_ONLY))
> +		return 0; /* error but caught downstream */
> +
> +	if (src->size > big_file_threshold || dst->size > big_file_threshold)
> +		return 0; /* too big to be worth computation */
> +
>  	if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
>  		return 0; /* error but caught downstream */
>  
Previous: Jeff King
Message 6 of 6 in “Bug? Error during commit”
  1. Andreas KalzFeb 5, 2018
  2. Duy NguyenFeb 5, 2018
  3. Jeff KingFeb 7, 2018
  4. Duy NguyenFeb 10, 2018
  5. Jeff KingFeb 10, 2018
  6. Junio C HamanoFeb 14, 2018

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.