ソースを参照

Fix dulwich.objects

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):