hash binary sha1 into patch id
authorClemens Buchacher <drizzd@aon.at>
Sun, 15 Aug 2010 07:20:43 +0000 (09:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Aug 2010 01:31:37 +0000 (18:31 -0700)
commit34597c1f5a77c710dae33092cb8a7cb01c6b21c1
tree8d9ec7281371366dd225e639960118bc4d5a33a8
parent64fdc08dac6694d1e754580e7acb82dfa4988bb9
hash binary sha1 into patch id

Since commit 2f82f760 (Take binary diffs into
account for "git rebase"), binary files are
included in patch ID computation. Binary files are
diffed using the text diff algorithm, however,
which has a huge impact on performance. The
following tests performance for a 50000 line file
marked as binary in .gitattributes.

$ git format-patch --stdout --ignore-if-in-upstream master

real    0m0.367s
user    0m0.354s
sys     0m0.010s

Instead of diffing the binary files, hash the pre-
and post-image sha1, which is just as unique. As a
result, performance is much improved.

$ git format-patch --stdout --ignore-if-in-upstream master

real    0m0.016s
user    0m0.015s
sys     0m0.001s

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c