diff mercurial/patch.py @ 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 9e8298a324ac
children 7032dcff290c
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)