Thread (3 messages) 3 messages, 3 authors, 2016-06-15

Re: A bug in git 1.6.5.2 with git log --stat: shows a negative number as a size

flat view

From: Tomas Carnecky <hidden>
Date: 2016-06-15 22:48:39

On 4/16/10 3:59 PM, Heikki Orsila wrote:
I'm running git version 1.6.5.2. git log --stat shows a negative
diffstat size for two files that are each 2049MiB in size.

Steps to reproduce:

$ for f in 0 1 ; do dd bs=$((1024*1024)) if=/dev/zero of=$f count=2049 ; done
$ git add 0 1
$ git commit -m "test commit"
$ git log --stat
commit 6afe3d3c889daa92bd79956c4bb733eb5cb408dc
Author: Heikki Orsila[off-list ref]
Date:   2010-04-16 16:54:52 +0300

     test commit

  0 |  Bin 0 ->  -2146435072 bytes
  1 |  Bin 0 ->  -2146435072 bytes
  2 files changed, 0 insertions(+), 0 deletions(-)
Yep, bug is also in the latest version (1.7.0.5). The code uses 'int' instead of something big enough to hold the size of your files.

http://git.kernel.org/?p=git/git.git;a=blob;f=diff.c;h=a1bf1e9cb37104cda8168c5118769ce5bbcfcbb2;hb=HEAD#l1105

and a couple lines below (1124) you see that the stat is printed out.

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