diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-22 11:57:44 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | 442f6cd854d972c3797ca203c8de6943fe81d2ca (patch) | |
tree | bd4b60dce12233f2bc15111efd7c473b58005b39 /pkg/gui/presentation | |
parent | c2b154acad4e1040bdc0e09cf44733ccd877923b (diff) |
more cherry picking stuff, mostly around the reflog
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r-- | pkg/gui/presentation/reflog_commits.go | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/pkg/gui/presentation/reflog_commits.go b/pkg/gui/presentation/reflog_commits.go index cf3765b1c..b7530e2b9 100644 --- a/pkg/gui/presentation/reflog_commits.go +++ b/pkg/gui/presentation/reflog_commits.go @@ -7,10 +7,10 @@ import ( "github.com/jesseduffield/lazygit/pkg/utils" ) -func GetReflogCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool, diffName string) [][]string { +func GetReflogCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffName string) [][]string { lines := make([][]string, len(commits)) - var displayFunc func(*commands.Commit, bool) []string + var displayFunc func(*commands.Commit, map[string]bool, bool) []string if fullDescription { displayFunc = getFullDescriptionDisplayStringsForReflogCommit } else { @@ -19,27 +19,41 @@ func GetReflogCommitListDisplayStrings(commits []*commands.Commit, fullDescripti for i := range commits { diffed := commits[i].Sha == diffName - lines[i] = displayFunc(commits[i], diffed) + lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap, diffed) } return lines } -func getFullDescriptionDisplayStringsForReflogCommit(c *commands.Commit, diffed bool) []string { +func coloredReflogSha(c *commands.Commit, cherryPickedCommitShaMap map[string]bool) string { + var shaColor *color.Color + if cherryPickedCommitShaMap[c.Sha] { + shaColor = color.New(color.FgCyan, color.BgBlue) + } else { + shaColor = color.New(color.FgBlue) + } + + return shaColor.Sprint(c.ShortSha()) +} + +func getFullDescriptionDisplayStringsForReflogCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool, diffed bool) []string { colorAttr := theme.DefaultTextColor if diffed { colorAttr = theme.DiffTerminalColor } return []string{ - utils.ColoredString(c.ShortSha(), color.FgBlue), + coloredReflogSha(c, cherryPickedCommitShaMap), utils.ColoredString(utils.UnixToDate(c.UnixTimestamp), color.FgMagenta), utils.ColoredString(c.Name, colorAttr), } } -func getDisplayStringsForReflogCommit(c *commands.Commit, diffed bool) []string { +func getDisplayStringsForReflogCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool, diffed bool) []string { defaultColor := color.New(theme.DefaultTextColor) - return []string{utils.ColoredString(c.ShortSha(), color.FgBlue), defaultColor.Sprint(c.Name)} + return []string{ + coloredReflogSha(c, cherryPickedCommitShaMap), + defaultColor.Sprint(c.Name), + } } |