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

Method index_git_sha

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

2674 /// Called after each commit is imported to enable O(1) incremental lookups.
2675 /// The `change_hash` is the Atomic Blake3 hash returned by write_import_*.
2676 pub fn index_git_sha(&self, git_sha: &str, change_hash: &Hash) -> Result<(), RepositoryError> {
2677 use atomic_core::pristine::GitShaIndexMutTxnT;
2678
2679 let mut txn = self
2680 .pristine
2681 .write_txn()
2682 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2683
2684 // Get the entity_id for this change hash
2685 let entity_id = txn
2686 .get_internal(change_hash)
2687 .map_err(|e| RepositoryError::Database(e.to_string()))?
2688 .ok_or_else(|| {
2689 RepositoryError::Database(format!(
2690 "Change hash not found in INTERNAL: {}",
2691 change_hash.to_base32()
2692 ))
2693 })?;
2694
2695 txn.put_git_sha(git_sha, entity_id)
2696 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2697
2698 txn.commit()
2699 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2700
2701 Ok(())
2702 }
2703
2704 /// Record missing Git SHA → Atomic change mappings in one transaction.
2705 ///

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