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])
| 558 | /// the durable `TREE` (tracking was already performed), and is skipped for |
| 559 | /// paths Git's index already covers. |
| 560 | pub(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 | |
| 572 | fn create_intent_to_add_entries(repo_root: &Path, requested: &[PathBuf]) -> CliResult<()> { |
| 573 | use git2::{IndexEntry, IndexTime, ObjectType, Oid}; |
no test coverage detected