← Back to team overview

dulwich-users team mailing list archive

[PATCH 10/33] pack: PackStreamReader SHA calculation and docstring cleanup.

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

Change-Id: I193c8c9af7bd3ea58b14b82095562712d913e77d
---
 dulwich/pack.py |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dulwich/pack.py b/dulwich/pack.py
index e487786..a773751 100644
--- a/dulwich/pack.py
+++ b/dulwich/pack.py
@@ -646,7 +646,7 @@ class PackStreamReader(object):
         """Read up to size bytes using the given callback.
 
         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 size: The maximum number of bytes to read; the particular
@@ -736,10 +736,9 @@ class PackStreamReader(object):
             buf.seek(0)
             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):
-- 
1.7.3.1



References