feat: track checkout identity for pinned diff editability
This commit is contained in:
+6
-4
@@ -4864,7 +4864,7 @@ mod tests {
|
||||
fn diff_borders_keep_full_revisions_and_each_panes_own_editability() {
|
||||
let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(180, 12)).unwrap();
|
||||
let mut panels = WheelPanels::default();
|
||||
for case in ["working", "unlisted", "historical", "binary"] {
|
||||
for case in ["working", "checked_out", "unlisted", "historical", "binary"] {
|
||||
let mut file = syntax_diff_file("new.rs", "fn old() {}", "fn new() {}");
|
||||
file.status = FileStatus::Renamed;
|
||||
file.old_path = Some("old.rs".into());
|
||||
@@ -4876,14 +4876,14 @@ mod tests {
|
||||
let comparison = diff.comparison.as_mut().unwrap();
|
||||
comparison.before = "abcdef0123456789 (baseline)".into();
|
||||
comparison.after = "fedcba9876543210 (destination)".into();
|
||||
if case != "unlisted" {
|
||||
if matches!(case, "working" | "checked_out" | "binary") {
|
||||
comparison.editable_paths.insert("new.rs".into());
|
||||
}
|
||||
if case == "historical" {
|
||||
if matches!(case, "historical" | "checked_out") {
|
||||
diff.after.as_mut().unwrap().target =
|
||||
crate::diff::RevisionTarget::Commit("fedcba9876543210".into());
|
||||
}
|
||||
let writable = case == "working";
|
||||
let writable = matches!(case, "working" | "checked_out");
|
||||
assert_eq!(diff.after_editable(), writable, "{case}");
|
||||
for focus in [Focus::Before, Focus::After] {
|
||||
diff.focus = focus;
|
||||
@@ -9737,6 +9737,7 @@ end
|
||||
}
|
||||
git(&["add", "."]);
|
||||
git(&["commit", "-qm", "base"]);
|
||||
git(&["commit", "--allow-empty", "-qm", "unmatched checkout"]);
|
||||
for index in 0..8 {
|
||||
directory.file(
|
||||
&format!("file-{index}.txt"),
|
||||
@@ -9763,6 +9764,7 @@ end
|
||||
ready(&mut session, Phase::Before);
|
||||
session.handle(Input::Enter);
|
||||
session.handle(Input::Down);
|
||||
session.handle(Input::Down);
|
||||
session.handle(Input::Enter);
|
||||
ready(&mut session, Phase::View);
|
||||
let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(120, 18)).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user