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

Function finish_service_add

atomic-cli/src/commands/add.rs:560–570  ·  view source on GitHub ↗

Create intent-to-add Git index entries for newly durably tracked files in a colocated repository. The entry mirrors `git add -N`: it records intent only (empty blob OID + the intent-to-add extended flag). It never stages content, never touches the durable `TREE` (tracking was already performed), and is skipped for paths Git's index already covers.

(repo_root: &Path, requested: &[PathBuf])

Source from the content-addressed store, hash-verified

558/// the durable `TREE` (tracking was already performed), and is skipped for
559/// paths Git's index already covers.
560pub(crate) fn finish_service_add(repo_root: &Path, requested: &[PathBuf]) -> CliResult<()> {
561 if !repo_root.join(".git").exists() {
562 return Ok(());
563 }
564 let repo = Repository::open_readonly_wait(repo_root, atomic_repository::database_lock_wait())
565 .map_err(CliError::Repository)?;
566 if repo.shim_workspace_active().map_err(CliError::Repository)? {
567 create_intent_to_add_entries(repo_root, requested)?;
568 }
569 Ok(())
570}
571
572fn create_intent_to_add_entries(repo_root: &Path, requested: &[PathBuf]) -> CliResult<()> {
573 use git2::{IndexEntry, IndexTime, ObjectType, Oid};

Callers 1

addFunction · 0.85

Calls 4

database_lock_waitFunction · 0.85
shim_workspace_activeMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected