John Carr 16 роки тому
батько
коміт
4485e98eb3
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      dulwich/objects.py

+ 3 - 3
dulwich/objects.py

@@ -55,9 +55,9 @@ def sha_to_hex(sha):
 def hex_to_sha(hex):
   """Takes a hex sha and returns a binary sha"""
   sha = ''
-  for i in range(0,19):
-    sha += chr(int(hex[i:i+2], 16))
-  assert len(sha) == 20, "Incorrent length of sha1"
+  for i in range(0,20):
+    sha += chr(int(hex[i*2:i*2+2], 16))
+  assert len(sha) == 20, "Incorrent length of sha1: %d" % len(sha)
   return sha
 
 class ShaFile(object):