Print the status in long (human-readable) format.
(&self, status: &RepositoryStatus)
| 383 | |
| 384 | /// Print the status in long (human-readable) format. |
| 385 | fn print_long_format(&self, status: &RepositoryStatus) -> CliResult<()> { |
| 386 | // Print view info |
| 387 | print!("On view "); |
| 388 | println!("{}", style_view(status.view())); |
| 389 | |
| 390 | // Print state hash if available |
| 391 | if let Some(state) = status.state() { |
| 392 | let state_str = state.to_base32(); |
| 393 | // Truncate to default hash length for display |
| 394 | let short_state = if state_str.len() > DEFAULT_HASH_LENGTH { |
| 395 | format!("{}...", &state_str[..DEFAULT_HASH_LENGTH]) |
| 396 | } else { |
| 397 | state_str |
| 398 | }; |
| 399 | print!("State: "); |
| 400 | println!("{}", hash(&short_state)); |
| 401 | } |
| 402 | |
| 403 | print_blank(); |
| 404 | |
| 405 | // Check if there are any changes |
| 406 | let has_changes = status.modified_count() > 0 |
| 407 | || status.deleted_count() > 0 |
| 408 | || status.added_count() > 0 |
| 409 | || status.pending_untrack_count() > 0 |
| 410 | || status.conflicted_count() > 0 |
| 411 | || status.type_changed_count() > 0 |
| 412 | || status.permissions_changed_count() > 0; |
| 413 | |
| 414 | let has_untracked = status.untracked_count() > 0; |
| 415 | |
| 416 | if !has_changes && !has_untracked { |
| 417 | println!("{}", info("nothing to record, working tree clean")); |
| 418 | return Ok(()); |
| 419 | } |
| 420 | |
| 421 | // Advisory notices (e.g. the RFC §8.3 conflict-snapshot caveat) are |
| 422 | // surfaced before the file listing so the distinction between a |
| 423 | // committed conflict snapshot and Git unmerged stages is explicit. |
| 424 | for notice in status.notices() { |
| 425 | print_warning(notice); |
| 426 | } |
| 427 | |
| 428 | // Print changes section |
| 429 | if has_changes { |
| 430 | print_section("Changes to be recorded:"); |
| 431 | println!( |
| 432 | " {}", |
| 433 | hint("(use \"atomic restore <file>...\" to discard changes)") |
| 434 | ); |
| 435 | if status.pending_untrack_count() > 0 { |
| 436 | println!( |
| 437 | " {}", |
| 438 | hint( |
| 439 | "(use \"atomic add <file>...\" to cancel a pending untrack; \ |
| 440 | 'atomic record' completes it)" |
| 441 | ) |
| 442 | ); |