1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-23 22:24:51 +02:00

Show original todo action instead of "conflict", and show <-- CONFLICT instead

It is useful to see if the conflicted commit was a "pick" or an "edit". What's
more, we're about to add support for showing cherry-picks and reverts, and
seeing that a conflicted commit was a revert is important because its diff is
backwards compared to the diff of the conflicting files in the Files panel.
This commit is contained in:
Stefan Haller
2024-06-13 16:55:20 +02:00
parent 9c8f987934
commit ff465e2581
19 changed files with 81 additions and 63 deletions

View File

@@ -186,7 +186,7 @@ func GetCommitListDisplayStrings(
unfilteredIdx := i + startIdx
bisectStatus = getBisectStatus(unfilteredIdx, commit.Hash, bisectInfo, bisectBounds)
isYouAreHereCommit := false
if showYouAreHereLabel && (commit.Action == models.ActionConflict || unfilteredIdx == rebaseOffset) {
if showYouAreHereLabel && (commit.Status == models.StatusConflicted || unfilteredIdx == rebaseOffset) {
isYouAreHereCommit = true
showYouAreHereLabel = false
}
@@ -395,8 +395,7 @@ func displayCommit(
actionString := ""
if commit.Action != models.ActionNone {
todoString := lo.Ternary(commit.Action == models.ActionConflict, "conflict", commit.Action.String())
actionString = actionColorMap(commit.Action).Sprint(todoString) + " "
actionString = actionColorMap(commit.Action, commit.Status).Sprint(commit.Action.String()) + " "
}
tagString := ""
@@ -429,8 +428,13 @@ func displayCommit(
mark := ""
if isYouAreHereCommit {
color := lo.Ternary(commit.Action == models.ActionConflict, style.FgRed, style.FgYellow)
youAreHere := color.Sprintf("<-- %s ---", common.Tr.YouAreHere)
color := style.FgYellow
text := common.Tr.YouAreHere
if commit.Status == models.StatusConflicted {
color = style.FgRed
text = common.Tr.ConflictLabel
}
youAreHere := color.Sprintf("<-- %s ---", text)
mark = fmt.Sprintf("%s ", youAreHere)
} else if isMarkedBaseCommit {
rebaseFromHere := style.FgYellow.Sprint(common.Tr.MarkedCommitMarker)
@@ -501,7 +505,7 @@ func getHashColor(
hashColor = style.FgYellow
case models.StatusMerged:
hashColor = style.FgGreen
case models.StatusRebasing:
case models.StatusRebasing, models.StatusConflicted:
hashColor = style.FgBlue
case models.StatusReflog:
hashColor = style.FgBlue
@@ -519,7 +523,11 @@ func getHashColor(
return hashColor
}
func actionColorMap(action todo.TodoCommand) style.TextStyle {
func actionColorMap(action todo.TodoCommand, status models.CommitStatus) style.TextStyle {
if status == models.StatusConflicted {
return style.FgRed
}
switch action {
case todo.Pick:
return style.FgCyan
@@ -529,8 +537,6 @@ func actionColorMap(action todo.TodoCommand) style.TextStyle {
return style.FgGreen
case todo.Fixup:
return style.FgMagenta
case models.ActionConflict:
return style.FgRed
default:
return style.FgYellow
}