Write an empty commit (no file changes).
(
&self,
repo: &mut Repository,
parsed: &ParsedCommit,
header: ChangeHeader,
)
| 3287 | |
| 3288 | /// Write an empty commit (no file changes). |
| 3289 | fn write_empty_commit( |
| 3290 | &self, |
| 3291 | repo: &mut Repository, |
| 3292 | parsed: &ParsedCommit, |
| 3293 | header: ChangeHeader, |
| 3294 | ) -> CliResult<ImportedCommitInfo> { |
| 3295 | let commit_start = Instant::now(); |
| 3296 | let metadata = self.build_git_metadata(parsed, true, false); |
| 3297 | let write_outcome = repo |
| 3298 | .write_import_recorded(header, &[], metadata, &[], Default::default()) |
| 3299 | .map_err(|e| CliError::Internal(e.into()))?; |
| 3300 | // Index git SHA → Atomic change in GIT_SHA_INDEX |
| 3301 | let _ = repo.index_git_sha(&parsed.git_sha, &write_outcome.hash); |
| 3302 | |
| 3303 | trace_git_import(format!( |
| 3304 | "write {} files=0 recorded=0 add_batch=0ms record=0ms assemble={}ms save={}ms apply={}ms direct_graph={}ms direct_crdt={}ms commit={}ms cleanup=0ms total={}ms empty_commit=true", |
| 3305 | parsed.short_sha, |
| 3306 | write_outcome.timings.assemble_ms, |
| 3307 | write_outcome.timings.save_ms, |
| 3308 | write_outcome.timings.apply_ms, |
| 3309 | write_outcome.timings.direct_graph_ms, |
| 3310 | write_outcome.timings.direct_crdt_ms, |
| 3311 | write_outcome.timings.commit_ms, |
| 3312 | commit_start.elapsed().as_millis() |
| 3313 | )); |
| 3314 | |
| 3315 | Ok(ImportedCommitInfo { |
| 3316 | git_sha: parsed.git_sha.clone(), |
| 3317 | short_sha: parsed.short_sha.clone(), |
| 3318 | atomic_hash: write_outcome.hash, |
| 3319 | is_merge: parsed.is_merge, |
| 3320 | message: parsed.full_message(), |
| 3321 | }) |
| 3322 | } |
| 3323 | |
| 3324 | /// Build git metadata for the change's unhashed field. |
| 3325 | fn build_git_metadata( |
no test coverage detected