mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
Load diff base from correct relative path
This commit is contained in:
parent
836b536a90
commit
3f4be5521c
2 changed files with 15 additions and 8 deletions
|
@ -4673,13 +4673,18 @@ impl Project {
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let relative_repo = match path.strip_prefix(repo.content_path) {
|
||||||
|
Ok(relative_repo) => relative_repo.to_owned(),
|
||||||
|
Err(_) => return,
|
||||||
|
};
|
||||||
|
|
||||||
let shared_remote_id = self.shared_remote_id();
|
let shared_remote_id = self.shared_remote_id();
|
||||||
let client = self.client.clone();
|
let client = self.client.clone();
|
||||||
|
|
||||||
cx.spawn(|_, mut cx| async move {
|
cx.spawn(|_, mut cx| async move {
|
||||||
let diff_base = cx
|
let diff_base = cx
|
||||||
.background()
|
.background()
|
||||||
.spawn(async move { repo.repo.lock().load_index(&path) })
|
.spawn(async move { repo.repo.lock().load_index(&relative_repo) })
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let buffer_id = buffer.update(&mut cx, |buffer, cx| {
|
let buffer_id = buffer.update(&mut cx, |buffer, cx| {
|
||||||
|
|
|
@ -667,13 +667,15 @@ impl LocalWorktree {
|
||||||
cx.spawn(|this, mut cx| async move {
|
cx.spawn(|this, mut cx| async move {
|
||||||
let text = fs.load(&abs_path).await?;
|
let text = fs.load(&abs_path).await?;
|
||||||
|
|
||||||
let diff_base = if let Some(repo) = snapshot.repo_for(&abs_path) {
|
let diff_base = if let Some(repo) = snapshot.repo_for(&path) {
|
||||||
cx.background()
|
if let Ok(repo_relative) = path.strip_prefix(repo.content_path) {
|
||||||
.spawn({
|
let repo_relative = repo_relative.to_owned();
|
||||||
let path = path.clone();
|
cx.background()
|
||||||
async move { repo.repo.lock().load_index(&path) }
|
.spawn(async move { repo.repo.lock().load_index(&repo_relative) })
|
||||||
})
|
.await
|
||||||
.await
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue