]> arthur.barton.de Git - bup.git/commitdiff
git.PackWriter: assert on no precalculated sha
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 22 Oct 2021 19:10:22 +0000 (21:10 +0200)
committerRob Browning <rlb@defaultvalue.org>
Fri, 1 Jul 2022 19:01:03 +0000 (14:01 -0500)
We really don't have any code path getting here without
a sha, so don't try to make up for it if it's missing,
just assert.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/git.py

index 5d46cc7b6099245ae8a527227328f0c8c0913b6d..f7ff94b057e0bbe56a66f3609279f64e7cf24730 100644 (file)
@@ -855,8 +855,7 @@ class PackWriter(object):
     def _write(self, sha, type, content):
         if verbose:
             log('>')
-        if not sha:
-            sha = calc_hash(type, content)
+        assert sha
         size, crc = self._raw_write(_encode_packobj(type, content,
                                                     self.compression_level),
                                     sha=sha)