Mercurial > hg-stable
changeset 19875:c172660eee01 stable
patch: Fix nullid for binary git diffs (issue4054)
The index for an empty file in git is not 0, but sha-1("blobl 0\0").
author | Johan Bjork <jbjoerk@gmail.com> |
---|---|
date | Mon, 07 Oct 2013 17:47:19 -0400 |
parents | 4d513f96a565 |
children | 7032dcff290c 52ed85d9ac26 |
files | mercurial/patch.py tests/test-diff-upgrade.t tests/test-git-export.t |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Tue Oct 01 16:55:20 2013 -0700 +++ b/mercurial/patch.py Mon Oct 07 17:47:19 2013 -0400 @@ -10,7 +10,7 @@ import tempfile, zlib, shutil from i18n import _ -from node import hex, nullid, short +from node import hex, short import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error import context @@ -1658,7 +1658,7 @@ def gitindex(text): if not text: - return hex(nullid) + text = "" l = len(text) s = util.sha1('blob %d\0' % l) s.update(text)
--- a/tests/test-diff-upgrade.t Tue Oct 01 16:55:20 2013 -0700 +++ b/tests/test-diff-upgrade.t Mon Oct 07 17:47:19 2013 -0400 @@ -183,7 +183,7 @@ % git=auto: git diff for newbinary diff --git a/newbinary b/newbinary new file mode 100644 - index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d + index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 Ic${MZ000310RR91 @@ -200,7 +200,7 @@ % git=auto: git diff for rmbinary diff --git a/rmbinary b/rmbinary deleted file mode 100644 - index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000 + index f76dd238ade08917e6712764a16a22005a50573d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@<O00001
--- a/tests/test-git-export.t Tue Oct 01 16:55:20 2013 -0700 +++ b/tests/test-git-export.t Mon Oct 07 17:47:19 2013 -0400 @@ -113,7 +113,7 @@ $ cat b.diff diff --git a/binfile.bin b/binfile.bin new file mode 100644 - index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9 + index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9 GIT binary patch literal 593 zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU