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

Method index_git_sha

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

2762 /// Called after each commit is imported to enable O(1) incremental lookups.
2763 /// The `change_hash` is the Atomic Blake3 hash returned by write_import_*.
2764 pub fn index_git_sha(&self, git_sha: &str, change_hash: &Hash) -> Result<(), RepositoryError> {
2765 use atomic_core::pristine::GitShaIndexMutTxnT;
2766
2767 let mut txn = self
2768 .pristine
2769 .write_txn()
2770 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2771
2772 // Get the entity_id for this change hash
2773 let entity_id = txn
2774 .get_internal(change_hash)
2775 .map_err(|e| RepositoryError::Database(e.to_string()))?
2776 .ok_or_else(|| {
2777 RepositoryError::Database(format!(
2778 "Change hash not found in INTERNAL: {}",
2779 change_hash.to_base32()
2780 ))
2781 })?;
2782
2783 txn.put_git_sha(git_sha, entity_id)
2784 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2785
2786 txn.commit()
2787 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2788
2789 Ok(())
2790 }
2791
2792 /// Record missing Git SHA → Atomic change mappings in one transaction.
2793 ///

Callers 4

try_squash_insertMethod · 0.80
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