improves the git feature by adding a conflict status

This commit is contained in:
2026-10-30 16:47:34 +01:00
parent caec81e762
commit 0278d7fbd1
14 changed files with 10927 additions and 19 deletions
+2 -2
View File
@@ -131,14 +131,14 @@ public enum Porcelain {
}
}
/// A merge conflict. Neither half can be staged on its own, so it stays one row.
/// A merge conflict. Neither half can be staged on its own, so it stays one unstaged `U` row.
public static func isConflict(index: Character, working: Character) -> Bool {
index == "U" || working == "U" || (index == "A" && working == "A") || (index == "D" && working == "D")
}
/// Splits an XY pair into rows: "MM" is a staged row plus an unstaged row, never one folded row.
public static func classify(index: Character, working: Character) -> [GitRowSpec] {
if isConflict(index: index, working: working) { return [GitRowSpec(status: .modified, staged: true)] }
if isConflict(index: index, working: working) { return [GitRowSpec(status: .unmerged, staged: false)] }
var rows: [GitRowSpec] = []
if index != " " && index != "?" { rows.append(GitRowSpec(status: status(for: index), staged: true)) }
if working != " " { rows.append(GitRowSpec(status: status(for: working), staged: false)) }