Dulwich.io dulwich / 42ae7e2
Only write index file if one doesn't yet exist. Jelmer Vernooń≥ 23 days ago
1 changed file(s) with 4 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
726726 with PackData(path) as p:
727727 entries = p.sorted_entries()
728728 basename = self._get_pack_basepath(entries)
729 with GitFile(basename+".idx", "wb") as f:
730 write_pack_index_v2(f, entries, p.get_stored_checksum())
729 index_name = basename + ".idx"
730 if not os.path.exists(index_name):
731 with GitFile(index_name, "wb") as f:
732 write_pack_index_v2(f, entries, p.get_stored_checksum())
731733 for pack in self.packs:
732734 if pack._basename == basename:
733735 return pack