+ # effectively, we don't bother messing with IX_SHAMISSING if
+ # not IX_HASHVALID, since it's redundant, and repacking is more
+ # expensive than not repacking.
+ # This is implemented by having sha_missing() check IX_HASHVALID too.
+ def set_sha_missing(self, val):
+ val = val and 1 or 0
+ oldval = self.sha_missing() and 1 or 0
+ if val != oldval:
+ flag = val and IX_SHAMISSING or 0
+ newflags = (self.flags & (~IX_SHAMISSING)) | flag
+ self.flags = newflags
+ self.repack()
+
+ def unset_sha_missing(self, flag):
+ if self.flags & IX_SHAMISSING:
+ self.flags &= ~IX_SHAMISSING
+ self.repack()
+