Split conflicts into their own section (#24324)

Co-Authored-By: Mikayla <mikayla@zed.dev>

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2025-02-05 18:34:14 -07:00 committed by GitHub
parent 5d1c56829a
commit 0a70627f00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 171 additions and 42 deletions

View file

@ -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()