Worktree paths in git panel, take 2 (#26047)
Modified version of #25950. We still use worktree paths, but repo paths with a status that lie outside the worktree are not excluded; instead, we relativize them by adding `..`. This makes the list in the git panel match what you'd get from running `git status` (with the repo's worktree root as the working directory). - [x] Implement + test new unrelativization logic - [x] ~~When collecting repositories, dedup by .git abs path, so worktrees can share a repo at the project level~~ dedup repos at the repository selector layer, with repos coming from larger worktrees being preferred - [x] Open single-file worktree with diff when activating a path not in the worktree Release Notes: - N/A
This commit is contained in:
parent
330e799293
commit
1763dd714b
23 changed files with 724 additions and 184 deletions
|
@ -602,7 +602,7 @@ mod tests {
|
|||
use serde_json::json;
|
||||
use task::TaskTemplates;
|
||||
use util::path;
|
||||
use workspace::CloseInactiveTabsAndPanes;
|
||||
use workspace::{CloseInactiveTabsAndPanes, OpenOptions, OpenVisible};
|
||||
|
||||
use crate::{modal::Spawn, tests::init_test};
|
||||
|
||||
|
@ -653,7 +653,15 @@ mod tests {
|
|||
|
||||
let _ = workspace
|
||||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(PathBuf::from(path!("/dir/a.ts")), true, window, cx)
|
||||
workspace.open_abs_path(
|
||||
PathBuf::from(path!("/dir/a.ts")),
|
||||
OpenOptions {
|
||||
visible: Some(OpenVisible::All),
|
||||
..Default::default()
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -819,7 +827,10 @@ mod tests {
|
|||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(
|
||||
PathBuf::from(path!("/dir/file_with.odd_extension")),
|
||||
true,
|
||||
OpenOptions {
|
||||
visible: Some(OpenVisible::All),
|
||||
..Default::default()
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
|
@ -846,7 +857,10 @@ mod tests {
|
|||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(
|
||||
PathBuf::from(path!("/dir/file_without_extension")),
|
||||
true,
|
||||
OpenOptions {
|
||||
visible: Some(OpenVisible::All),
|
||||
..Default::default()
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
|
@ -954,7 +968,15 @@ mod tests {
|
|||
|
||||
let _ts_file_1 = workspace
|
||||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(PathBuf::from(path!("/dir/a1.ts")), true, window, cx)
|
||||
workspace.open_abs_path(
|
||||
PathBuf::from(path!("/dir/a1.ts")),
|
||||
OpenOptions {
|
||||
visible: Some(OpenVisible::All),
|
||||
..Default::default()
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -995,7 +1017,15 @@ mod tests {
|
|||
|
||||
let _ts_file_2 = workspace
|
||||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(PathBuf::from(path!("/dir/a2.ts")), true, window, cx)
|
||||
workspace.open_abs_path(
|
||||
PathBuf::from(path!("/dir/a2.ts")),
|
||||
OpenOptions {
|
||||
visible: Some(OpenVisible::All),
|
||||
..Default::default()
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1018,7 +1048,15 @@ mod tests {
|
|||
|
||||
let _rs_file = workspace
|
||||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(PathBuf::from(path!("/dir/b.rs")), true, window, cx)
|
||||
workspace.open_abs_path(
|
||||
PathBuf::from(path!("/dir/b.rs")),
|
||||
OpenOptions {
|
||||
visible: Some(OpenVisible::All),
|
||||
..Default::default()
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1033,7 +1071,15 @@ mod tests {
|
|||
emulate_task_schedule(tasks_picker, &project, "Rust task", cx);
|
||||
let _ts_file_2 = workspace
|
||||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(PathBuf::from(path!("/dir/a2.ts")), true, window, cx)
|
||||
workspace.open_abs_path(
|
||||
PathBuf::from(path!("/dir/a2.ts")),
|
||||
OpenOptions {
|
||||
visible: Some(OpenVisible::All),
|
||||
..Default::default()
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue