ux: show conflict short format in changes view

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-30 10:42:02 +08:00
parent e40ca4bbe0
commit 75015d550c
No known key found for this signature in database
5 changed files with 64 additions and 62 deletions

View file

@ -49,7 +49,10 @@ namespace SourceGit.Models
public string OriginalPath { get; set; } = "";
public ChangeDataForAmend DataForAmend { get; set; } = null;
public ConflictReason ConflictReason { get; set; } = ConflictReason.None;
public bool IsConflicted => WorkTree == ChangeState.Conflicted;
public string ConflictMarker => CONFLICT_MARKERS[(int)ConflictReason];
public string ConflictDesc => CONFLICT_DESCS[(int)ConflictReason];
public void Set(ChangeState index, ChangeState workTree = ChangeState.None)
{
@ -81,5 +84,28 @@ namespace SourceGit.Models
if (!string.IsNullOrEmpty(OriginalPath) && OriginalPath[0] == '"')
OriginalPath = OriginalPath.Substring(1, OriginalPath.Length - 2);
}
private static readonly string[] CONFLICT_MARKERS =
[
string.Empty,
"DD",
"AU",
"UD",
"UA",
"DU",
"AA",
"UU"
];
private static readonly string[] CONFLICT_DESCS =
[
string.Empty,
"Both deleted",
"Added by us",
"Deleted by them",
"Added by them",
"Deleted by us",
"Both added",
"Both modified"
];
}
}