`atomic diff -c ` over GetChange — every form: the change resolves (full hash, `#N` sequence, or prefix — the same ChangeRef arms `atomic change` uses), the versioned change bundle deserializes into the domain Change, and the SAME render flow the local `-c` body runs prints it. The request's file-content reconstruction carries each touched file's pre/post-change bytes: the FileOps hunks pad th
(args: &super::diff::command::Diff, change_ref: &str)
| 2524 | /// legacy no-file_ops changes build their diffs from the reconstructed |
| 2525 | /// content — the exception is gone. |
| 2526 | fn diff_change(args: &super::diff::command::Diff, change_ref: &str) -> CliResult<bool> { |
| 2527 | use super::change::types::ChangeIdentifier; |
| 2528 | let Some(session) = Service::open()? else { |
| 2529 | return Ok(false); |
| 2530 | }; |
| 2531 | let parsed = ChangeIdentifier::parse(Some(change_ref)) |
| 2532 | .map_err(|error| CliError::InvalidArgument { message: error })?; |
| 2533 | let reference = match parsed { |
| 2534 | ChangeIdentifier::FullHash(hash) => { |
| 2535 | let mut bytes = [0u8; 32]; |
| 2536 | bytes.copy_from_slice(&hash.0); |
| 2537 | pb::ChangeRef { |
| 2538 | kind: Some(pb::change_ref::Kind::Hash(pb::Hash { |
| 2539 | value: bytes.to_vec(), |
| 2540 | algorithm: pb::HashAlgorithm::Blake3 as i32, |
| 2541 | })), |
| 2542 | } |
| 2543 | } |
| 2544 | ChangeIdentifier::Sequence(sequence) => pb::ChangeRef { |
| 2545 | kind: Some(pb::change_ref::Kind::Sequence(sequence)), |
| 2546 | }, |
| 2547 | // "Latest" (`@`/empty) resolves through the daemon's Log like the |
| 2548 | // `change` hook does: the view's newest change. |
| 2549 | ChangeIdentifier::Latest => { |
| 2550 | let entries = session.log(pb::LogRequest { |
| 2551 | repository: Some(session.reference.clone()), |
| 2552 | all_views: false, |
| 2553 | view: args.view.clone(), |
| 2554 | cursor: None, |
| 2555 | budget: Some(pb::PageBudget { |
| 2556 | max_items: Some(1), |
| 2557 | max_bytes: None, |
| 2558 | }), |
| 2559 | path_filter: Vec::new(), |
| 2560 | tags_only: false, |
| 2561 | })?; |
| 2562 | let Some(entry) = entries.entries.first() else { |
| 2563 | return Err(CliError::ChangeNotFound { |
| 2564 | hash: "latest".to_string(), |
| 2565 | }); |
| 2566 | }; |
| 2567 | let hash = entry |
| 2568 | .hash |
| 2569 | .clone() |
| 2570 | .ok_or_else(|| CliError::Internal(anyhow::anyhow!("log entry carries no hash")))?; |
| 2571 | pb::ChangeRef { |
| 2572 | kind: Some(pb::change_ref::Kind::Hash(hash)), |
| 2573 | } |
| 2574 | } |
| 2575 | _ => pb::ChangeRef { |
| 2576 | kind: Some(pb::change_ref::Kind::Prefix(change_ref.to_string())), |
| 2577 | }, |
| 2578 | }; |
| 2579 | |
| 2580 | let response = session.get_change(pb::GetChangeRequest { |
| 2581 | repository: Some(session.reference.clone()), |
| 2582 | r#ref: Some(reference), |
| 2583 | includes: Some(pb::ChangeIncludes { |
no test coverage detected