(
repository: Arc<RepositoryContext>,
token: &RepositoryWriteToken,
options: CommitOptions,
keys: LoreArray<LoreString>,
values: LoreArray<LoreString>,
formats: LoreArray<LoreM
| 320 | } |
| 321 | |
| 322 | pub async fn commit_impl( |
| 323 | repository: Arc<RepositoryContext>, |
| 324 | token: &RepositoryWriteToken, |
| 325 | options: CommitOptions, |
| 326 | keys: LoreArray<LoreString>, |
| 327 | values: LoreArray<LoreString>, |
| 328 | formats: LoreArray<LoreMetadataType>, |
| 329 | ) -> Result<Hash, CommitError> { |
| 330 | if let Some(ref link_path) = options.link { |
| 331 | return commit_link_only( |
| 332 | repository, |
| 333 | token.share(), |
| 334 | options.message.clone(), |
| 335 | link_path.clone(), |
| 336 | keys, |
| 337 | values, |
| 338 | formats, |
| 339 | options.stats, |
| 340 | ) |
| 341 | .await; |
| 342 | } |
| 343 | |
| 344 | if let Some(ref layer_path) = options.layer { |
| 345 | let layer_message = options |
| 346 | .layer_messages |
| 347 | .get(layer_path) |
| 348 | .cloned() |
| 349 | .unwrap_or_else(|| options.message.clone()); |
| 350 | return commit_layer_only( |
| 351 | repository, |
| 352 | token.share(), |
| 353 | layer_message, |
| 354 | layer_path.clone(), |
| 355 | keys, |
| 356 | values, |
| 357 | formats, |
| 358 | options.stats, |
| 359 | ) |
| 360 | .await; |
| 361 | } |
| 362 | |
| 363 | let context = execution_context(); |
| 364 | let globals = context.globals(); |
| 365 | let dry_run = globals.dry_run(); |
| 366 | |
| 367 | let layers = layer::list(repository.clone()).await.unwrap_or_default(); |
| 368 | let mut layer_staged = false; |
| 369 | for layer in &layers { |
| 370 | lore_debug!("Layer status: {layer:?}"); |
| 371 | if !layer.staged.is_zero() && layer.staged != layer.current { |
| 372 | layer_staged = true; |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | let (current_revision, current_branch) = crate::instance::load_current_anchor(&repository) |
| 377 | .await |
| 378 | .forward::<CommitError>("Failed to deserialize current revision anchor")?; |
| 379 | let staged_revision = match crate::instance::load_staged_revision(&repository).await { |
no test coverage detected