diff: fix binary file removals in git mode.
With the previous version, a binary file removal diff generated with
--- a/mercurial/patch.py Sun Mar 24 16:56:25 2013 -0700
+++ b/mercurial/patch.py Mon Mar 04 22:34:11 2013 +0000
@@ -1756,6 +1756,8 @@
else:
header.append('deleted file mode %s\n' %
gitmode[man1.flags(f)])
+ if util.binary(to):
+ dodiff = 'binary'
elif not to or util.binary(to):
# regular diffs cannot represent empty file deletion
losedatafn(f)
--- a/tests/test-diff-upgrade.t Sun Mar 24 16:56:25 2013 -0700
+++ b/tests/test-diff-upgrade.t Mon Mar 04 22:34:11 2013 +0000
@@ -200,7 +200,11 @@
% git=auto: git diff for rmbinary
diff --git a/rmbinary b/rmbinary
deleted file mode 100644
- Binary file rmbinary has changed
+ index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000
+ GIT binary patch
+ literal 0
+ Hc$@<O00001
+
% git=auto: git diff for bintoregular
diff --git a/bintoregular b/bintoregular
@@ -210,6 +214,7 @@
Uc$`bh%qz(+N=+}#Ni5<5043uE82|tP
+
git=warn: regular diff with data loss warnings
$ hg autodiff --git=warn