浏览代码

pack: PackStreamReader SHA calculation and docstring cleanup.

Change-Id: I193c8c9af7bd3ea58b14b82095562712d913e77d
Dave Borowitz 13 年之前
父节点
当前提交
6e434b19d7
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      dulwich/pack.py

+ 4 - 5
dulwich/pack.py

@@ -646,7 +646,7 @@ class PackStreamReader(object):
         """Read up to size bytes using the given callback.
         """Read up to size bytes using the given callback.
 
 
         As a side effect, update the verifier's hash (excluding the last 20
         As a side effect, update the verifier's hash (excluding the last 20
-        bytes read) and write through to the output file.
+        bytes read).
 
 
         :param read: The read callback to read from.
         :param read: The read callback to read from.
         :param size: The maximum number of bytes to read; the particular
         :param size: The maximum number of bytes to read; the particular
@@ -736,10 +736,9 @@ class PackStreamReader(object):
             buf.seek(0)
             buf.seek(0)
             self._rbuf = buf
             self._rbuf = buf
 
 
-        pack_sha = sha_to_hex(''.join([c for c in self._trailer]))
-        calculated_sha = self.sha.hexdigest()
-        if pack_sha != calculated_sha:
-            raise ChecksumMismatch(pack_sha, calculated_sha)
+        pack_sha = ''.join(self._trailer)
+        if pack_sha != self.sha.digest():
+            raise ChecksumMismatch(sha_to_hex(pack_sha), self.sha.hexdigest())
 
 
 
 
 def obj_sha(type, chunks):
 def obj_sha(type, chunks):