Re: Bug? Error during commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> 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.

>
> ---
> 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 */
>  



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux