Write an empty commit (no file changes).
(
&self,
repo: &mut Repository,
parsed: &ParsedCommit,
header: ChangeHeader,
)
| 3308 | |
| 3309 | /// Write an empty commit (no file changes). |
| 3310 | fn write_empty_commit( |
| 3311 | &self, |
| 3312 | repo: &mut Repository, |
| 3313 | parsed: &ParsedCommit, |
| 3314 | header: ChangeHeader, |
| 3315 | ) -> CliResult<ImportedCommitInfo> { |
| 3316 | let commit_start = Instant::now(); |
| 3317 | let metadata = self.build_git_metadata(parsed, true, false); |
| 3318 | let write_outcome = repo |
| 3319 | .write_import_recorded( |
| 3320 | header, |
| 3321 | &[], |
| 3322 | metadata, |
| 3323 | &[], |
| 3324 | self.options.preserve_working_copy, |
| 3325 | Default::default(), |
| 3326 | ) |
| 3327 | .map_err(|e| CliError::Internal(e.into()))?; |
| 3328 | // Index git SHA → Atomic change in GIT_SHA_INDEX |
| 3329 | let _ = repo.index_git_sha(&parsed.git_sha, &write_outcome.hash); |
| 3330 | |
| 3331 | trace_git_import(format!( |
| 3332 | "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", |
| 3333 | parsed.short_sha, |
| 3334 | write_outcome.timings.assemble_ms, |
| 3335 | write_outcome.timings.save_ms, |
| 3336 | write_outcome.timings.apply_ms, |
| 3337 | write_outcome.timings.direct_graph_ms, |
| 3338 | write_outcome.timings.direct_crdt_ms, |
| 3339 | write_outcome.timings.commit_ms, |
| 3340 | commit_start.elapsed().as_millis() |
| 3341 | )); |
| 3342 | |
| 3343 | Ok(ImportedCommitInfo { |
| 3344 | git_sha: parsed.git_sha.clone(), |
| 3345 | short_sha: parsed.short_sha.clone(), |
| 3346 | atomic_hash: write_outcome.hash, |
| 3347 | is_merge: parsed.is_merge, |
| 3348 | message: parsed.full_message(), |
| 3349 | }) |
| 3350 | } |
| 3351 | |
| 3352 | /// Build git metadata for the change's unhashed field. |
| 3353 | fn build_git_metadata( |
no test coverage detected