{"thread":{"id":"25433","subject":"Spurious line insertion/deletion stats for binary file","startedAt":"2010-10-12T22:47:54Z","lastAt":"2010-10-15T19:26:57Z","messageCount":2,"participants":["Kevin Ballard","Neal Kreitzinger"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"153354","messageId":"8CFCE61F-591A-4B56-B701-D1A391FBB088@sb.org","threadId":"25433","inReplyTo":null,"subject":"Spurious line insertion/deletion stats for binary file","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2010-10-12T22:47:54Z","receivedAt":"2010-10-12T22:47:54Z","isPatch":false,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"I just noticed something fairly odd when making a commit that changed a single binary file:\n\nkevin> (develop +=)> git ci -m 'Replace binary file'\n[develop c0c3b98] Replace binary file\n 1 files changed, 8 insertions(+), 14 deletions(-)\n rewrite Resources/some_image.png (99%)\n\nThe commit results seem to be treating the binary file as text in order to give me insertion/deletion stats. This is quite obviously wrong. For this situation, a fairly simple solution would be to change that line to something like\n\n 1 files changed, 2652 bytes removed\n\nbut the correct behavior is a bit less obvious when there are multiple files changed. Does anyone have a good suggestion for how to handle this case?\n\n-Kevin Ballard"},{"id":"153598","messageId":"i9a9va$ror$1@dough.gmane.org","threadId":"25433","inReplyTo":"8CFCE61F-591A-4B56-B701-D1A391FBB088@sb.org","subject":"Re: Spurious line insertion/deletion stats for binary file","fromName":"Neal Kreitzinger","fromEmail":"neal@rsss.com","sentAt":"2010-10-15T19:26:57Z","receivedAt":"2010-10-15T19:26:57Z","isPatch":false,"sender":{"key":"neal@rsss.com","avatar":null},"body":"\"Kevin Ballard\" <kevin@sb.org> wrote in message \nnews:8CFCE61F-591A-4B56-B701-D1A391FBB088@sb.org...\n>I just noticed something fairly odd when making a commit that changed a \n>single binary file:\n>\n> kevin> (develop +=)> git ci -m 'Replace binary file'\n> [develop c0c3b98] Replace binary file\n> 1 files changed, 8 insertions(+), 14 deletions(-)\n> rewrite Resources/some_image.png (99%)\n>\n> The commit results seem to be treating the binary file as text in order to \n> give me insertion/deletion stats. This is quite obviously wrong. For this \n> situation, a fairly simple solution would be to change that line to \n> something like\n>\n> 1 files changed, 2652 bytes removed\n>\n> but the correct behavior is a bit less obvious when there are multiple \n> files changed. Does anyone have a good suggestion for how to handle this \n> case?\n>\n> -Kevin Ballard--\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\nWe track all our binaries so each commit is a working state of our system. \nGit just seems to know they are binaries and reports them as such in the \ndiff pane of gitk:  \"Binary files a/path/binaryA and b/path/binaryA differ\". \nWe are currently using 1.7.1.  I guess it \"knows\" they are binaries because \nwe don't their paths in the \"gitattributes\" file.\n\nBased on the gitattributes manpage, it sounds like you have \"diff\" set for \nthe path to your binary listed in your .git/info/attributes (git attributes) \nfile.  If the binary is in the same path as the source you could set the \n\"binary\" attribute macro for your binary(s) if the path or name is \ndistinguishable from the source.  I played around with this in the past, but \ncurrently don't have a need for it in my current configuration, so I'm \ngetting all of this from the gitattributes manpage, \nhttp://www.kernel.org/pub/software/scm/git/docs/v1.7.1.2/gitattributes.html.\n\nv/r,\nNeal\n"}]}