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

Method index_git_sha

atomic-repository/src/repository/insert.rs:3686–3712  ·  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

3684 /// Called after each commit is imported to enable O(1) incremental lookups.
3685 /// The `change_hash` is the Atomic Blake3 hash returned by write_import_*.
3686 pub fn index_git_sha(&self, git_sha: &str, change_hash: &Hash) -> Result<(), RepositoryError> {
3687 use atomic_core::pristine::GitShaIndexMutTxnT;
3688
3689 let mut txn = self
3690 .pristine
3691 .write_txn()
3692 .map_err(|e| RepositoryError::Database(e.to_string()))?;
3693
3694 // Get the entity_id for this change hash
3695 let entity_id = txn
3696 .get_internal(change_hash)
3697 .map_err(|e| RepositoryError::Database(e.to_string()))?
3698 .ok_or_else(|| {
3699 RepositoryError::Database(format!(
3700 "Change hash not found in INTERNAL: {}",
3701 change_hash.to_base32()
3702 ))
3703 })?;
3704
3705 txn.put_git_sha(git_sha, entity_id)
3706 .map_err(|e| RepositoryError::Database(e.to_string()))?;
3707
3708 txn.commit()
3709 .map_err(|e| RepositoryError::Database(e.to_string()))?;
3710
3711 Ok(())
3712 }
3713
3714 /// Record missing Git SHA → Atomic change mappings in one transaction.
3715 ///

Calls 4

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