MCPcopy Index your code
hub / github.com/emwalker/digraph / save_link

Method save_link

backend/src/git/client.rs:639–658  ·  view source on GitHub ↗
(&mut self, repo_id: RepoId, link: &RepoLink)

Source from the content-addressed store, hash-verified

637 }
638
639 pub fn save_link(&mut self, repo_id: RepoId, link: &RepoLink) -> Result<()> {
640 self.check_can_update(repo_id)?;
641
642 let view = self.client.view(repo_id)?;
643 let link_id = link.id();
644 let before = view.link(link_id)?;
645 let before = self.client.link_searches(before)?;
646 let after = self.client.link_searches(Some(link.to_owned()))?;
647 self.indexer.update(
648 &self.client,
649 repo_id,
650 &link.to_search_entry(),
651 &before,
652 &after,
653 )?;
654 let s = serde_yaml::to_string(&link)?;
655 let oid = self.client.repo(repo_id)?.add_blob(s.as_bytes())?;
656
657 self.save_object(repo_id, link_id, oid)
658 }
659
660 fn save_object(&mut self, repo_id: RepoId, id: &ExternalId, oid: git2::Oid) -> Result<()> {
661 let filename = id.object_filename()?;

Callers 3

callMethod · 0.80
callMethod · 0.80
persist_linkFunction · 0.80

Calls 12

to_stringFunction · 0.85
check_can_updateMethod · 0.80
link_searchesMethod · 0.80
updateMethod · 0.80
to_search_entryMethod · 0.80
add_blobMethod · 0.80
as_bytesMethod · 0.80
save_objectMethod · 0.80
viewMethod · 0.45
idMethod · 0.45
linkMethod · 0.45
repoMethod · 0.45

Tested by

no test coverage detected