Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkuiZhang committed Oct 17, 2024
1 parent d988ffd commit 21956f6
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 15 deletions.
6 changes: 5 additions & 1 deletion crates/assistant/src/slash_command/file_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ fn collect_files(
} else {
let entry_name = format!("{}/{}", prefix_paths, &filename);
output.text.push_str(&entry_name);
directory_stack.push((entry.relative_path.clone(), entry_name, entry_start));
directory_stack.push((
entry.relative_path.clone(),
entry_name,
entry_start,
));
}
output.text.push('\n');
} else if entry.is_file() {
Expand Down
4 changes: 2 additions & 2 deletions crates/project/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ impl ProjectEnvironment {
let load_direnv = ProjectSettings::get_global(cx).load_direnv.clone();

cx.spawn(|this, mut cx| async move {
let abs_path = worktree_abs_path.clone();
let (mut shell_env, error_message) = cx
.background_executor()
.spawn(async move {
load_shell_environment(worktree_abs_path.as_raw_path_buf(), &load_direnv)
.await
load_shell_environment(abs_path.as_raw_path_buf(), &load_direnv).await
})
.await;

Expand Down
2 changes: 1 addition & 1 deletion crates/project/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3128,7 +3128,7 @@ impl Project {
abs_path: &SanitizedPathBuf,
visible: bool,
cx: &mut ModelContext<Self>,
) -> Task<Result<(Model<Worktree>, PathBuf)>> {
) -> Task<Result<(Model<Worktree>, SanitizedPathBuf)>> {
self.worktree_store.update(cx, |worktree_store, cx| {
worktree_store.find_or_create_worktree(abs_path, visible, cx)
})
Expand Down
2 changes: 1 addition & 1 deletion crates/project/src/terminals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub fn wrap_for_ssh(
// shlex will wrap the command in single quotes (''), disabling ~ expansion,
// replace ith with something that works
let tilde_prefix = "~/";
if path.starts_with(tilde_prefix) {
if path.as_trimmed_path_buf().starts_with(tilde_prefix) {
let trimmed_path = path_string
.trim_start_matches("/")
.trim_start_matches("~")
Expand Down
7 changes: 3 additions & 4 deletions crates/project/src/worktree_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,16 @@ impl WorktreeStore {

pub fn find_or_create_worktree(
&mut self,
abs_path: impl AsRef<Path>,
abs_path: &SanitizedPathBuf,
visible: bool,
cx: &mut ModelContext<Self>,
) -> Task<Result<(Model<Worktree>, PathBuf)>> {
let abs_path = abs_path.as_ref();
) -> Task<Result<(Model<Worktree>, SanitizedPathBuf)>> {
if let Some((tree, relative_path)) = self.find_worktree(abs_path, cx) {
Task::ready(Ok((tree, relative_path)))
} else {
let worktree = self.create_worktree(abs_path, visible, cx);
cx.background_executor()
.spawn(async move { Ok((worktree.await?, PathBuf::new())) })
.spawn(async move { Ok((worktree.await?, SanitizedPathBuf::new())) })
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/recent_projects/src/dev_servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use ui::Scrollbar;
use ui::ScrollbarState;
use ui::Section;
use ui::{prelude::*, IconButtonShape, List, ListItem, ListSeparator, Modal, ModalHeader, Tooltip};
use util::paths::SanitizedPathBuf;
use util::ResultExt;
use workspace::notifications::NotificationId;
use workspace::OpenOptions;
Expand Down Expand Up @@ -244,6 +243,7 @@ impl ProjectPicker {

let tasks = paths
.into_iter()
.map(Into::into)
.map(|path| {
project.update(cx, |project, cx| {
project.find_or_create_worktree(&path, true, cx)
Expand Down
2 changes: 1 addition & 1 deletion crates/remote_server/src/headless_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ impl HeadlessProject {
buffer_store.open_buffer(
ProjectPath {
worktree_id: worktree.read(cx).id(),
path: path.into(),
path: path.as_trimmed_path_buf().into(),
},
cx,
)
Expand Down
6 changes: 5 additions & 1 deletion crates/search/src/project_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2736,7 +2736,11 @@ pub mod tests {
assert!(a_dir_entry.is_dir());
window
.update(cx, |workspace, cx| {
ProjectSearchView::new_search_in_directory(workspace, &a_dir_entry.relative_path, cx)
ProjectSearchView::new_search_in_directory(
workspace,
&a_dir_entry.relative_path,
cx,
)
})
.unwrap();

Expand Down
14 changes: 11 additions & 3 deletions crates/worktree/src/worktree_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1731,9 +1731,17 @@ fn randomly_mutate_worktree(
Ok(())
})
} else {
log::info!("overwriting file {:?} ({})", entry.relative_path, entry.id.0);
let task =
worktree.write_file(entry.relative_path.clone(), "".into(), Default::default(), cx);
log::info!(
"overwriting file {:?} ({})",
entry.relative_path,
entry.id.0
);
let task = worktree.write_file(
entry.relative_path.clone(),
"".into(),
Default::default(),
cx,
);
cx.background_executor().spawn(async move {
task.await?;
Ok(())
Expand Down

0 comments on commit 21956f6

Please sign in to comment.