{"thread":{"id":"33328","subject":"gitdiffbinstat - git diff --shortstat -like output for changes in binary files","startedAt":"2013-03-29T18:07:32Z","lastAt":"2013-03-29T19:30:11Z","messageCount":4,"participants":["Matthias Krüger","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"212638","messageId":"5155D864.8040007@famsik.de","threadId":"33328","inReplyTo":null,"subject":"gitdiffbinstat - git diff --shortstat -like output for changes in binary files","fromName":"Matthias Krüger","fromEmail":"matthias.krueger@famsik.de","sentAt":"2013-03-29T18:07:32Z","receivedAt":"2013-03-29T18:07:32Z","isPatch":false,"sender":{"key":"matthias.krueger@famsik.de","avatar":"https://avatars.githubusercontent.com/u/476013?v=4"},"body":"I use git mostly for game-development which means I have to deal with a \nlot of binary files (images, sound files etc).\n\nWhen I came to a point where I had run image optimization on a branch, I \nwanted to know of course how much smaller the new branch was in \ncomparison to master.\nProblem was that 'git diff --stat' would only summerize per-binary-file \nsize changes and 'git diff --shortstat' did skip the binary files entirely.\n\nTo solve this problem, I wrote a script (\"gitdiffbinstat\") which \nbasically runs 'git diff --stat' and summerizes the output.\n\nThe script can be found here: \nhttps://github.com/matthiaskrgr/gitdiffbinstat/blob/master/gitdiffbinstat.sh\nScreenshot of example output is attached.\n\nI wondered what you guys thought about the script, is there a chance to \nperhaps get it included as some kind of helper script into the official \ngit repo?\n\n\nRegards, Matthias\n"},{"id":"212640","messageId":"20130329184922.GB13506@sigill.intra.peff.net","threadId":"33328","inReplyTo":"5155D864.8040007@famsik.de","subject":"Re: gitdiffbinstat - git diff --shortstat -like output for changes in binary files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-03-29T18:49:22Z","receivedAt":"2013-03-29T18:49:22Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 29, 2013 at 07:07:32PM +0100, Matthias Krüger wrote:\n\n> I use git mostly for game-development which means I have to deal with\n> a lot of binary files (images, sound files etc).\n> \n> When I came to a point where I had run image optimization on a\n> branch, I wanted to know of course how much smaller the new branch\n> was in comparison to master.\n> Problem was that 'git diff --stat' would only summerize\n> per-binary-file size changes and 'git diff --shortstat' did skip the\n> binary files entirely.\n\nHave you tried \"--summary\"? Combined with --stat (or --shortstat) I\nwonder if it would get you closer to what you want.\n\n-Peff\n"},{"id":"212642","messageId":"5155EA08.60005@famsik.de","threadId":"33328","inReplyTo":"20130329184922.GB13506@sigill.intra.peff.net","subject":"Re: gitdiffbinstat - git diff --shortstat -like output for changes in binary files","fromName":"Matthias Krüger","fromEmail":"matthias.krueger@famsik.de","sentAt":"2013-03-29T19:22:48Z","receivedAt":"2013-03-29T19:22:48Z","isPatch":false,"sender":{"key":"matthias.krueger@famsik.de","avatar":"https://avatars.githubusercontent.com/u/476013?v=4"},"body":"On 03/29/2013 07:49 PM, Jeff King wrote:\n> On Fri, Mar 29, 2013 at 07:07:32PM +0100, Matthias Krüger wrote:\n>\n>> I use git mostly for game-development which means I have to deal with\n>> a lot of binary files (images, sound files etc).\n>>\n>> When I came to a point where I had run image optimization on a\n>> branch, I wanted to know of course how much smaller the new branch\n>> was in comparison to master.\n>> Problem was that 'git diff --stat' would only summerize\n>> per-binary-file size changes and 'git diff --shortstat' did skip the\n>> binary files entirely.\n> Have you tried \"--summary\"? Combined with --stat (or --shortstat) I\n> wonder if it would get you closer to what you want.\n>\n> -Peff\nNo it doesnt.\nIt appears to append stuff like\n\n  delete mode 100644 sound/music/NewTutorialStage.ogg\n  delete mode 100644 src/pngfuncs.c\n  delete mode 100644 src/pngfuncs.h\n  delete mode 100644 src/widgets/widget_text_list.c\n  delete mode 100644 src/widgets/widget_text_list.h\n\nto the stat but does not summarize the binary file size changes.\n"},{"id":"212643","messageId":"7vip4angvw.fsf@alter.siamese.dyndns.org","threadId":"33328","inReplyTo":"20130329184922.GB13506@sigill.intra.peff.net","subject":"Re: gitdiffbinstat - git diff --shortstat -like output for changes in binary files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-29T19:30:11Z","receivedAt":"2013-03-29T19:30:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> I use git mostly for game-development which means I have to deal with\n>> a lot of binary files (images, sound files etc).\n>> \n>> When I came to a point where I had run image optimization on a\n>> branch, I wanted to know of course how much smaller the new branch\n>> was in comparison to master.\n>> Problem was that 'git diff --stat' would only summerize\n>> per-binary-file size changes and 'git diff --shortstat' did skip the\n>> binary files entirely.\n>\n> Have you tried \"--summary\"? Combined with --stat (or --shortstat) I\n> wonder if it would get you closer to what you want.\n\n\"diff\" is not about \"how much did my project grow or shink\".  If you\nmoved one block of lines up or down in the same file, you will see\ndouble the number of lines moved in the statistics.\n\nOn the other hand, the use case to measure how much it helped to run\npng optimizers only cares about the total size.\n\nI do not think it is a good match to present the \"binary stat\" next\nto the textual diff stats in the first place.  Adding two numbers do\nnot give us any meaningful number.\n\nIt is an interesting use case, but it just is not a problem core\nGit, which is a source code management system, particularly wants to\nbolt on a solution for, that does not mesh well with other parts of\nthe system.\n\nWe do want to make sure that people who want to deal with binaries\nhave access to raw statistics, so that they can build their solution\non top of, though.  \"ls-tree -r -l\" gives byte-size of each blob,\nand the attribute system can let you tell which paths are binaries.\n"}]}