MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / index_git_sha

Method index_git_sha

atomic-repository/src/repository/insert.rs:2731–2757  ·  view source on GitHub ↗

Record a Git SHA → Atomic change mapping in the GIT_SHA_INDEX. Called after each commit is imported to enable O(1) incremental lookups. The `change_hash` is the Atomic Blake3 hash returned by write_import_*.

(&self, git_sha: &str, change_hash: &Hash)

Source from the content-addressed store, hash-verified

2729 /// Called after each commit is imported to enable O(1) incremental lookups.
2730 /// The `change_hash` is the Atomic Blake3 hash returned by write_import_*.
2731 pub fn index_git_sha(&self, git_sha: &str, change_hash: &Hash) -> Result<(), RepositoryError> {
2732 use atomic_core::pristine::GitShaIndexMutTxnT;
2733
2734 let mut txn = self
2735 .pristine
2736 .write_txn()
2737 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2738
2739 // Get the entity_id for this change hash
2740 let entity_id = txn
2741 .get_internal(change_hash)
2742 .map_err(|e| RepositoryError::Database(e.to_string()))?
2743 .ok_or_else(|| {
2744 RepositoryError::Database(format!(
2745 "Change hash not found in INTERNAL: {}",
2746 change_hash.to_base32()
2747 ))
2748 })?;
2749
2750 txn.put_git_sha(git_sha, entity_id)
2751 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2752
2753 txn.commit()
2754 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2755
2756 Ok(())
2757 }
2758
2759 /// Record missing Git SHA → Atomic change mappings in one transaction.
2760 ///

Callers 3

write_commitMethod · 0.80
write_empty_commitMethod · 0.80

Calls 4

write_txnMethod · 0.80
put_git_shaMethod · 0.80
commitMethod · 0.80
get_internalMethod · 0.45

Tested by

no test coverage detected