1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-23 00:39:13 +02:00

more smart refreshing

WIP

WIP

WIP

WIP

WIP

fix how diff entries are handled

WIP

WIP

WIP

WIP

WIP

WIP
This commit is contained in:
Jesse Duffield
2020-03-27 21:25:37 +11:00
parent d0336fe16f
commit c1a4bd0482
7 changed files with 60 additions and 68 deletions

View File

@ -9,10 +9,10 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
func GetCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool) [][]string {
func GetCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffEntries []*commands.Commit) [][]string {
lines := make([][]string, len(commits))
var displayFunc func(*commands.Commit, map[string]bool) []string
var displayFunc func(*commands.Commit, map[string]bool, []*commands.Commit) []string
if fullDescription {
displayFunc = getFullDescriptionDisplayStringsForCommit
} else {
@ -20,13 +20,13 @@ func GetCommitListDisplayStrings(commits []*commands.Commit, fullDescription boo
}
for i := range commits {
lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap)
lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap, diffEntries)
}
return lines
}
func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool) []string {
func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool, diffEntries []*commands.Commit) []string {
red := color.New(color.FgRed)
yellow := color.New(color.FgYellow)
green := color.New(color.FgGreen)
@ -52,8 +52,6 @@ func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedC
shaColor = blue
case "reflog":
shaColor = blue
case "selected":
shaColor = magenta
default:
shaColor = defaultColor
}
@ -62,6 +60,12 @@ func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedC
shaColor = copied
}
for _, entry := range diffEntries {
if c.Sha == entry.Sha {
shaColor = magenta
}
}
tagString := ""
secondColumnString := blue.Sprint(utils.UnixToDate(c.UnixTimestamp))
if c.Action != "" {
@ -76,7 +80,7 @@ func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedC
return []string{shaColor.Sprint(c.ShortSha()), secondColumnString, yellow.Sprint(truncatedAuthor), tagString + defaultColor.Sprint(c.Name)}
}
func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool) []string {
func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool, diffEntries []*commands.Commit) []string {
red := color.New(color.FgRed)
yellow := color.New(color.FgYellow)
green := color.New(color.FgGreen)
@ -102,8 +106,6 @@ func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map
shaColor = blue
case "reflog":
shaColor = blue
case "selected":
shaColor = magenta
default:
shaColor = defaultColor
}
@ -112,6 +114,12 @@ func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map
shaColor = copied
}
for _, entry := range diffEntries {
if c.Sha == entry.Sha {
shaColor = magenta
}
}
actionString := ""
tagString := ""
if c.Action != "" {