Enable merge conflict parsing for currently-unmerged files (#31549)

Previously, we only enabled merge conflict parsing for files that were
unmerged at the last time a change was detected to the repo's merge
heads. Now we enable the parsing for these files *and* any files that
are currently unmerged.

The old strategy meant that conflicts produced via `git stash pop` would
not be parsed.

Release Notes:

- Fixed parsing of merge conflicts when the conflict was produced by a
`git stash pop`
This commit is contained in:
Max Brunsfeld 2025-05-27 13:34:39 -07:00 committed by GitHub
parent f54c057001
commit 697c2ba71f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 124 additions and 15 deletions

View file

@ -199,7 +199,9 @@ impl GitHeaderEntry {
let this = &self.header;
let status = status_entry.status;
match this {
Section::Conflict => repo.has_conflict(&status_entry.repo_path),
Section::Conflict => {
repo.had_conflict_on_last_merge_head_change(&status_entry.repo_path)
}
Section::Tracked => !status.is_created(),
Section::New => status.is_created(),
}
@ -2345,7 +2347,7 @@ impl GitPanel {
let repo = repo.read(cx);
for entry in repo.cached_status() {
let is_conflict = repo.has_conflict(&entry.repo_path);
let is_conflict = repo.had_conflict_on_last_merge_head_change(&entry.repo_path);
let is_new = entry.status.is_created();
let staging = entry.status.staging();
@ -2516,7 +2518,7 @@ impl GitPanel {
continue;
};
self.entry_count += 1;
if repo.has_conflict(&status_entry.repo_path) {
if repo.had_conflict_on_last_merge_head_change(&status_entry.repo_path) {
self.conflicted_count += 1;
if self.entry_staging(status_entry).has_staged() {
self.conflicted_staged_count += 1;

View file

@ -219,7 +219,7 @@ impl ProjectDiff {
};
let repo = git_repo.read(cx);
let namespace = if repo.has_conflict(&entry.repo_path) {
let namespace = if repo.had_conflict_on_last_merge_head_change(&entry.repo_path) {
CONFLICT_NAMESPACE
} else if entry.status.is_created() {
NEW_NAMESPACE
@ -372,7 +372,7 @@ impl ProjectDiff {
};
let namespace = if GitPanelSettings::get_global(cx).sort_by_path {
TRACKED_NAMESPACE
} else if repo.has_conflict(&entry.repo_path) {
} else if repo.had_conflict_on_last_merge_head_change(&entry.repo_path) {
CONFLICT_NAMESPACE
} else if entry.status.is_created() {
NEW_NAMESPACE