Split conflicts into their own section (#24324)
Co-Authored-By: Mikayla <mikayla@zed.dev> Release Notes: - N/A
This commit is contained in:
parent
5d1c56829a
commit
0a70627f00
13 changed files with 171 additions and 42 deletions
|
@ -46,6 +46,8 @@ pub trait GitRepository: Send + Sync {
|
|||
/// Returns the SHA of the current HEAD.
|
||||
fn head_sha(&self) -> Option<String>;
|
||||
|
||||
fn merge_head_shas(&self) -> Vec<String>;
|
||||
|
||||
/// Returns the list of git statuses, sorted by path
|
||||
fn status(&self, path_prefixes: &[RepoPath]) -> Result<GitStatus>;
|
||||
|
||||
|
@ -162,6 +164,18 @@ impl GitRepository for RealGitRepository {
|
|||
Some(self.repository.lock().head().ok()?.target()?.to_string())
|
||||
}
|
||||
|
||||
fn merge_head_shas(&self) -> Vec<String> {
|
||||
let mut shas = Vec::default();
|
||||
self.repository
|
||||
.lock()
|
||||
.mergehead_foreach(|oid| {
|
||||
shas.push(oid.to_string());
|
||||
true
|
||||
})
|
||||
.ok();
|
||||
shas
|
||||
}
|
||||
|
||||
fn status(&self, path_prefixes: &[RepoPath]) -> Result<GitStatus> {
|
||||
let working_directory = self
|
||||
.repository
|
||||
|
@ -387,6 +401,10 @@ impl GitRepository for FakeGitRepository {
|
|||
None
|
||||
}
|
||||
|
||||
fn merge_head_shas(&self) -> Vec<String> {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn dot_git_dir(&self) -> PathBuf {
|
||||
let state = self.state.lock();
|
||||
state.dot_git_dir.clone()
|
||||
|
|
|
@ -134,7 +134,11 @@ impl FileStatus {
|
|||
}
|
||||
|
||||
pub fn has_changes(&self) -> bool {
|
||||
self.is_modified() || self.is_created() || self.is_deleted() || self.is_untracked()
|
||||
self.is_modified()
|
||||
|| self.is_created()
|
||||
|| self.is_deleted()
|
||||
|| self.is_untracked()
|
||||
|| self.is_conflicted()
|
||||
}
|
||||
|
||||
pub fn is_modified(self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue