MCPcopy Create free account
hub / github.com/git/git / insert

Method insert

src/loose.rs:588–601  ·  view source on GitHub ↗

Insert an object into the map. If `write` is true and there is a batch started, write the object into the batch as well as into the memory map.

(&mut self, oid1: &ObjectID, oid2: &ObjectID, kind: MapType, write: bool)

Source from the content-addressed store, hash-verified

586 /// If `write` is true and there is a batch started, write the object into the batch as well as
587 /// into the memory map.
588 pub fn insert(&mut self, oid1: &ObjectID, oid2: &ObjectID, kind: MapType, write: bool) {
589 let (compat_oid, storage_oid) =
590 if HashAlgorithm::from_u32(oid1.algo) == Some(self.mem.compat) {
591 (oid1, oid2)
592 } else {
593 (oid2, oid1)
594 };
595 Self::insert_into(&mut self.mem, storage_oid, compat_oid, kind);
596 if write {
597 if let Some(ref mut batch) = self.batch {
598 Self::insert_into(batch, storage_oid, compat_oid, kind);
599 }
600 }
601 }
602
603 fn insert_into(
604 map: &mut ObjectMemoryMap,

Callers 3

newMethod · 0.80
insert_intoMethod · 0.80
test_mapFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_mapFunction · 0.64