Use a color other than yellow or red for commits on a branch that doesn't have an upstream

This commit is contained in:
Stefan Haller 2025-11-02 16:06:14 +01:00
parent 80dd695d7a
commit ed4d57c800
2 changed files with 6 additions and 3 deletions

View file

@ -546,7 +546,9 @@ func setCommitStatuses(unpushedCommitHashes *set.Set[string], unmergedCommitHash
}
if unmergedCommitHashes == nil || unmergedCommitHashes.Includes(commit.Hash()) {
if unpushedCommitHashes != nil && unpushedCommitHashes.Includes(commit.Hash()) {
if unpushedCommitHashes == nil {
commits[i].Status = models.StatusNone
} else if unpushedCommitHashes.Includes(commit.Hash()) {
commits[i].Status = models.StatusUnpushed
} else {
commits[i].Status = models.StatusPushed
@ -569,7 +571,7 @@ func (self *CommitLoader) getReachableHashes(refName string, notRefNames []strin
DontLog().
RunWithOutputs()
if err != nil {
return set.New[string]()
return nil
}
return set.NewFromSlice(utils.SplitLines(output))

View file

@ -483,6 +483,8 @@ func getHashColor(
diffed := commit.Hash() != "" && commit.Hash() == diffName
hashColor := theme.DefaultTextColor
switch commit.Status {
case models.StatusNone:
hashColor = style.FgMagenta // or style.FgCyan
case models.StatusUnpushed:
hashColor = style.FgRed
case models.StatusPushed:
@ -493,7 +495,6 @@ func getHashColor(
hashColor = style.FgBlue
case models.StatusReflog:
hashColor = style.FgBlue
default:
}
if diffed {