Project Diff 2 (#23891)
This adds a new version of the project diff editor to go alongside the new git panel. The basics seem to be working, but still todo: * [ ] Fix untracked files * [ ] Fix deleted files * [ ] Show commit message editor at top * [x] Handle empty state * [x] Fix panic where locator sometimes seeks to wrong excerpt Release Notes: - N/A
This commit is contained in:
parent
27a413a5e3
commit
45708d2680
21 changed files with 1023 additions and 125 deletions
|
@ -12,7 +12,7 @@ use gpui::{App, Context, Entity, EventEmitter, SharedString, Subscription, WeakE
|
|||
use rpc::{proto, AnyProtoClient};
|
||||
use settings::WorktreeId;
|
||||
use std::sync::Arc;
|
||||
use util::maybe;
|
||||
use util::{maybe, ResultExt};
|
||||
use worktree::{ProjectEntryId, RepositoryEntry, StatusEntry};
|
||||
|
||||
pub struct GitState {
|
||||
|
@ -332,7 +332,7 @@ impl GitState {
|
|||
impl RepositoryHandle {
|
||||
pub fn display_name(&self, project: &Project, cx: &App) -> SharedString {
|
||||
maybe!({
|
||||
let path = self.unrelativize(&"".into())?;
|
||||
let path = self.repo_path_to_project_path(&"".into())?;
|
||||
Some(
|
||||
project
|
||||
.absolute_path(&path, cx)?
|
||||
|
@ -367,11 +367,18 @@ impl RepositoryHandle {
|
|||
self.repository_entry.status()
|
||||
}
|
||||
|
||||
pub fn unrelativize(&self, path: &RepoPath) -> Option<ProjectPath> {
|
||||
pub fn repo_path_to_project_path(&self, path: &RepoPath) -> Option<ProjectPath> {
|
||||
let path = self.repository_entry.unrelativize(path)?;
|
||||
Some((self.worktree_id, path).into())
|
||||
}
|
||||
|
||||
pub fn project_path_to_repo_path(&self, path: &ProjectPath) -> Option<RepoPath> {
|
||||
if path.worktree_id != self.worktree_id {
|
||||
return None;
|
||||
}
|
||||
self.repository_entry.relativize(&path.path).log_err()
|
||||
}
|
||||
|
||||
pub fn stage_entries(
|
||||
&self,
|
||||
entries: Vec<RepoPath>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue