diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-04-03 12:40:29 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-04-15 08:36:03 +0200 |
commit | 188773511e0c94a4ec338328865e824402ec8b00 (patch) | |
tree | 9c6c9b596c52d382c857071312743ff26ee70ae6 /pkg/gui/presentation/commits.go | |
parent | 62c5c32fbb0a44713933724e5c941ee1d42c2b27 (diff) |
Store commit.Status as an enum instead of a string
This is unrelated to the changes in this PR, but since we are doing the same
thing for the commit.Action field in the next commit, it makes sense to do it
for Status too for consistency. Modelling this as an enum feels more natural
than modelling it as a string, since there's a finite set of possible values.
And it saves a little bit of memory (not very much, since none of the strings
were heap-allocated, but still).
Diffstat (limited to 'pkg/gui/presentation/commits.go')
-rw-r--r-- | pkg/gui/presentation/commits.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go index 77b946a64..f7d3e1308 100644 --- a/pkg/gui/presentation/commits.go +++ b/pkg/gui/presentation/commits.go @@ -346,16 +346,17 @@ func getShaColor( diffed := commit.Sha == diffName shaColor := theme.DefaultTextColor switch commit.Status { - case "unpushed": + case models.StatusUnpushed: shaColor = style.FgRed - case "pushed": + case models.StatusPushed: shaColor = style.FgYellow - case "merged": + case models.StatusMerged: shaColor = style.FgGreen - case "rebasing": + case models.StatusRebasing: shaColor = style.FgBlue - case "reflog": + case models.StatusReflog: shaColor = style.FgBlue + default: } if diffed { |