Make sure ids get updated when the object changes.
[jelmer/dulwich-libgit2.git] / dulwich / objects.py
index e328016aa1788b296d101e3d5abfb91f98c0b21b..969e65341e315752f33ce01defdb15e774947d22 100644 (file)
@@ -434,7 +434,7 @@ class ShaFile(object):
 
     def sha(self):
         """The SHA1 object that is the name of this object."""
-        if self._sha is None:
+        if self._sha is None or self._needs_serialization:
             # this is a local because as_raw_chunks() overwrites self._sha
             new_sha = make_sha()
             new_sha.update(self._header())