summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/context/local_commits_context.go6
-rw-r--r--pkg/gui/context/sub_commits_context.go6
-rw-r--r--pkg/gui/controllers/basic_commits_controller.go8
-rw-r--r--pkg/gui/controllers/helpers/host_helper.go6
-rw-r--r--pkg/gui/controllers/undo_controller.go24
-rw-r--r--pkg/gui/keybindings.go6
-rw-r--r--pkg/gui/presentation/commits.go26
-rw-r--r--pkg/gui/presentation/commits_test.go276
-rw-r--r--pkg/gui/presentation/graph/graph.go20
-rw-r--r--pkg/gui/presentation/reflog_commits.go4
10 files changed, 191 insertions, 191 deletions
diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go
index c6d7de991..043483fc9 100644
--- a/pkg/gui/context/local_commits_context.go
+++ b/pkg/gui/context/local_commits_context.go
@@ -29,12 +29,12 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {
)
getDisplayStrings := func(startIdx int, endIdx int) [][]string {
- selectedCommitSha := ""
+ selectedCommitHash := ""
if c.CurrentContext().GetKey() == LOCAL_COMMITS_CONTEXT_KEY {
selectedCommit := viewModel.GetSelected()
if selectedCommit != nil {
- selectedCommitSha = selectedCommit.Sha
+ selectedCommitHash = selectedCommit.Sha
}
}
@@ -55,7 +55,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {
c.UserConfig.Gui.ShortTimeFormat,
time.Now(),
c.UserConfig.Git.ParseEmoji,
- selectedCommitSha,
+ selectedCommitHash,
startIdx,
endIdx,
shouldShowGraph(c),
diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go
index d98188b91..9bad0b8cf 100644
--- a/pkg/gui/context/sub_commits_context.go
+++ b/pkg/gui/context/sub_commits_context.go
@@ -44,11 +44,11 @@ func NewSubCommitsContext(
return [][]string{}
}
- selectedCommitSha := ""
+ selectedCommitHash := ""
if c.CurrentContext().GetKey() == SUB_COMMITS_CONTEXT_KEY {
selectedCommit := viewModel.GetSelected()
if selectedCommit != nil {
- selectedCommitSha = selectedCommit.Sha
+ selectedCommitHash = selectedCommit.Sha
}
}
branches := []*models.Branch{}
@@ -70,7 +70,7 @@ func NewSubCommitsContext(
c.UserConfig.Gui.ShortTimeFormat,
time.Now(),
c.UserConfig.Git.ParseEmoji,
- selectedCommitSha,
+ selectedCommitHash,
startIdx,
endIdx,
// Don't show the graph in the left/right view; we'd like to, but
diff --git a/pkg/gui/controllers/basic_commits_controller.go b/pkg/gui/controllers/basic_commits_controller.go
index 1fde39e8b..8bf3b7969 100644
--- a/pkg/gui/controllers/basic_commits_controller.go
+++ b/pkg/gui/controllers/basic_commits_controller.go
@@ -125,9 +125,9 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
Title: self.c.Tr.Actions.CopyCommitAttributeToClipboard,
Items: []*types.MenuItem{
{
- Label: self.c.Tr.CommitSha,
+ Label: self.c.Tr.CommitHash,
OnPress: func() error {
- return self.copyCommitSHAToClipboard(commit)
+ return self.copyCommitHashToClipboard(commit)
},
},
{
@@ -169,8 +169,8 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
})
}
-func (self *BasicCommitsController) copyCommitSHAToClipboard(commit *models.Commit) error {
- self.c.LogAction(self.c.Tr.Actions.CopyCommitSHAToClipboard)
+func (self *BasicCommitsController) copyCommitHashToClipboard(commit *models.Commit) error {
+ self.c.LogAction(self.c.Tr.Actions.CopyCommitHashToClipboard)
if err := self.c.OS().CopyToClipboard(commit.Sha); err != nil {
return self.c.Error(err)
}
diff --git a/pkg/gui/controllers/helpers/host_helper.go b/pkg/gui/controllers/helpers/host_helper.go
index 77fdd530e..bbd464ba8 100644
--- a/pkg/gui/controllers/helpers/host_helper.go
+++ b/pkg/gui/controllers/helpers/host_helper.go
@@ -8,7 +8,7 @@ import (
type IHostHelper interface {
GetPullRequestURL(from string, to string) (string, error)
- GetCommitURL(commitSha string) (string, error)
+ GetCommitURL(commitHash string) (string, error)
}
type HostHelper struct {
@@ -31,12 +31,12 @@ func (self *HostHelper) GetPullRequestURL(from string, to string) (string, error
return mgr.GetPullRequestURL(from, to)
}
-func (self *HostHelper) GetCommitURL(commitSha string) (string, error) {
+func (self *HostHelper) GetCommitURL(commitHash string) (string, error) {
mgr, err := self.getHostingServiceMgr()
if err != nil {
return "", err
}
- return mgr.GetCommitURL(commitSha)
+ return mgr.GetCommitURL(commitHash)
}
// getting this on every request rather than storing it in state in case our remoteURL changes
diff --git a/pkg/gui/controllers/undo_controller.go b/pkg/gui/controllers/undo_controller.go
index c0a754794..402e07471 100644
--- a/pkg/gui/controllers/undo_controller.go
+++ b/pkg/gui/controllers/undo_controller.go
@@ -181,34 +181,34 @@ func (self *UndoController) reflogRedo() error {
func (self *UndoController) parseReflogForActions(onUserAction func(counter int, action reflogAction) (bool, error)) error {
counter := 0
reflogCommits := self.c.Model().FilteredReflogCommits
- rebaseFinishCommitSha := ""
+ rebaseFinishCommitHash := ""
var action *reflogAction
for reflogCommitIdx, reflogCommit := range reflogCommits {
action = nil
- prevCommitSha := ""
+ prevCommitHash := ""
if len(reflogCommits)-1 >= reflogCommitIdx+1 {
- prevCommitSha = reflogCommits[reflogCommitIdx+1].Sha
+ prevCommitHash = reflogCommits[reflogCommitIdx+1].Sha
}
- if rebaseFinishCommitSha == "" {
+ if rebaseFinishCommitHash == "" {
if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^\[lazygit undo\]`); ok {
counter++
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^\[lazygit redo\]`); ok {
counter--
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(abort\)|^rebase (-i )?\(finish\)`); ok {
- rebaseFinishCommitSha = reflogCommit.Sha
+ rebaseFinishCommitHash = reflogCommit.Sha
} else if ok, match := utils.FindStringSubmatch(reflogCommit.Name, `^checkout: moving from ([\S]+) to ([\S]+)`); ok {
action = &reflogAction{kind: CHECKOUT, from: match[1], to: match[2]}
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^commit|^reset: moving to|^pull`); ok {
- action = &reflogAction{kind: COMMIT, from: prevCommitSha, to: reflogCommit.Sha}
+ action = &reflogAction{kind: COMMIT, from: prevCommitHash, to: reflogCommit.Sha}
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(start\)`); ok {
// if we're here then we must be currently inside an interactive rebase
- action = &reflogAction{kind: CURRENT_REBASE, from: prevCommitSha}
+ action = &reflogAction{kind: CURRENT_REBASE, from: prevCommitHash}
}
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(start\)`); ok {
- action = &reflogAction{kind: REBASE, from: prevCommitSha, to: rebaseFinishCommitSha}
- rebaseFinishCommitSha = ""
+ action = &reflogAction{kind: REBASE, from: prevCommitHash, to: rebaseFinishCommitHash}
+ rebaseFinishCommitHash = ""
}
if action != nil {
@@ -232,9 +232,9 @@ type hardResetOptions struct {
}
// only to be used in the undo flow for now (does an autostash)
-func (self *UndoController) hardResetWithAutoStash(commitSha string, options hardResetOptions) error {
+func (self *UndoController) hardResetWithAutoStash(commitHash string, options hardResetOptions) error {
reset := func() error {
- if err := self.c.Helpers().Refs.ResetToRef(commitSha, "hard", options.EnvVars); err != nil {
+ if err := self.c.Helpers().Refs.ResetToRef(commitHash, "hard", options.EnvVars); err != nil {
return self.c.Error(err)
}
return nil
@@ -249,7 +249,7 @@ func (self *UndoController) hardResetWithAutoStash(commitSha string, options har
Prompt: self.c.Tr.AutoStashPrompt,
HandleConfirm: func() error {
return self.c.WithWaitingStatus(options.WaitingStatus, func(gocui.Task) error {
- if err := self.c.Git().Stash.Push(self.c.Tr.StashPrefix + commitSha); err != nil {
+ if err := self.c.Git().Stash.Push(self.c.Tr.StashPrefix + commitHash); err != nil {
return self.c.Error(err)
}
if err := reset(); err != nil {
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index 9c4acd1ee..c6bb8ada5 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -148,7 +148,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
- Description: self.c.Tr.CopyCommitShaToClipboard,
+ Description: self.c.Tr.CopyCommitHashToClipboard,
},
{
ViewName: "commits",
@@ -161,14 +161,14 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
- Description: self.c.Tr.CopyCommitShaToClipboard,
+ Description: self.c.Tr.CopyCommitHashToClipboard,
},
{
ViewName: "subCommits",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
- Description: self.c.Tr.CopyCommitShaToClipboard,
+ Description: self.c.Tr.CopyCommitHashToClipboard,
},
{
ViewName: "information",
diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go
index 58f465196..d6ae519c2 100644
--- a/pkg/gui/presentation/commits.go
+++ b/pkg/gui/presentation/commits.go
@@ -22,7 +22,7 @@ import (
)
type pipeSetCacheKey struct {
- commitSha string
+ commitHash string
commitCount int
}
@@ -43,14 +43,14 @@ func GetCommitListDisplayStrings(
currentBranchName string,
hasRebaseUpdateRefsConfig bool,
fullDescription bool,
- cherryPickedCommitShaSet *set.Set[string],
+ cherryPickedCommitHashSet *set.Set[string],
diffName string,
markedBaseCommit string,
timeFormat string,
shortTimeFormat string,
now time.Time,
parseEmoji bool,
- selectedCommitSha string,
+ selectedCommitHash string,
startIdx int,
endIdx int,
showGraph bool,
@@ -89,7 +89,7 @@ func GetCommitListDisplayStrings(
graphLines := graph.RenderAux(
graphPipeSets,
graphCommits,
- selectedCommitSha,
+ selectedCommitHash,
)
getGraphLine = func(idx int) string {
if idx >= graphOffset {
@@ -146,7 +146,7 @@ func GetCommitListDisplayStrings(
commit,
branchHeadsToVisualize,
hasRebaseUpdateRefsConfig,
- cherryPickedCommitShaSet,
+ cherryPickedCommitHashSet,
isMarkedBaseCommit,
willBeRebased,
diffName,
@@ -203,7 +203,7 @@ func loadPipesets(commits []*models.Commit) [][]*graph.Pipe {
// given that our cache key is a commit hash and a commit count, it's very important that we don't actually try to render pipes
// when dealing with things like filtered commits.
cacheKey := pipeSetCacheKey{
- commitSha: commits[0].Sha,
+ commitHash: commits[0].Sha,
commitCount: len(commits),
}
@@ -236,16 +236,16 @@ const (
BisectStatusCurrent
)
-func getBisectStatus(index int, commitSha string, bisectInfo *git_commands.BisectInfo, bisectBounds *bisectBounds) BisectStatus {
+func getBisectStatus(index int, commitHash string, bisectInfo *git_commands.BisectInfo, bisectBounds *bisectBounds) BisectStatus {
if !bisectInfo.Started() {
return BisectStatusNone
}
- if bisectInfo.GetCurrentSha() == commitSha {
+ if bisectInfo.GetCurrentSha() == commitHash {
return BisectStatusCurrent
}
- status, ok := bisectInfo.Status(commitSha)
+ status, ok := bisectInfo.Status(commitHash)
if ok {
switch status {
case git_commands.BisectStatusNew:
@@ -298,7 +298,7 @@ func displayCommit(
commit *models.Commit,
branchHeadsToVisualize *set.Set[string],
hasRebaseUpdateRefsConfig bool,
- cherryPickedCommitShaSet *set.Set[string],
+ cherryPickedCommitHashSet *set.Set[string],
isMarkedBaseCommit bool,
willBeRebased bool,
diffName string,
@@ -312,7 +312,7 @@ func displayCommit(
bisectInfo *git_commands.BisectInfo,
isYouAreHereCommit bool,
) []string {
- shaColor := getShaColor(commit, diffName, cherryPickedCommitShaSet, bisectStatus, bisectInfo)
+ shaColor := getShaColor(commit, diffName, cherryPickedCommitHashSet, bisectStatus, bisectInfo)
bisectString := getBisectStatusText(bisectStatus, bisectInfo)
actionString := ""
@@ -413,7 +413,7 @@ func getBisectStatusColor(status BisectStatus) style.TextStyle {
func getShaColor(
commit *models.Commit,
diffName string,
- cherryPickedCommitShaSet *set.Set[string],
+ cherryPickedCommitHashSet *set.Set[string],
bisectStatus BisectStatus,
bisectInfo *git_commands.BisectInfo,
) style.TextStyle {
@@ -439,7 +439,7 @@ func getShaColor(
if diffed {
shaColor = theme.DiffTerminalColor
- } else if cherryPickedCommitShaSet.Includes(commit.Sha) {
+ } else if cherryPickedCommitHashSet.Includes(commit.Sha) {
shaColor = theme.CherryPickedCommitTextStyle
} else if commit.Divergence == models.DivergenceRight && commit.Status != models.StatusMerged {
shaColor = style.FgBlue
diff --git a/pkg/gui/presentation/commits_test.go b/pkg/gui/presentation/commits_test.go
index f1f075f45..75f96eed9 100644
--- a/pkg/gui/presentation/commits_test.go
+++ b/pkg/gui/presentation/commits_test.go
@@ -22,38 +22,38 @@ func formatExpected(expected string) string {
func TestGetCommitListDisplayStrings(t *testing.T) {
scenarios := []struct {
- testName string
- commits []*models.Commit
- branches []*models.Branch
- currentBranchName string
- hasUpdateRefConfig bool
- fullDescription bool
- cherryPickedCommitShaSet *set.Set[string]
- markedBaseCommit string
- diffName string
- timeFormat string
- shortTimeFormat string
- now time.Time
- parseEmoji bool
- selectedCommitSha string
- startIdx int
- endIdx int
- showGraph bool
- bisectInfo *git_commands.BisectInfo
- showYouAreHereLabel bool
- expected string
- focus bool
+ testName string
+ commits []*models.Commit
+ branches []*models.Branch
+ currentBranchName string
+ hasUpdateRefConfig bool
+ fullDescription bool
+ cherryPickedCommitHashSet *set.Set[string]
+ markedBaseCommit string
+ diffName string
+ timeFormat string
+ shortTimeFormat string
+ now time.Time
+ parseEmoji bool
+ selectedCommitHash string
+ startIdx int
+ endIdx int
+ showGraph bool
+ bisectInfo *git_commands.BisectInfo
+ showYouAreHereLabel bool
+ expected string
+ focus bool
}{
{
- testName: "no commits",
- commits: []*models.Commit{},
- startIdx: 0,
- endIdx: 1,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
- expected: "",
+ testName: "no commits",
+ commits: []*models.Commit{},
+ startIdx: 0,
+ endIdx: 1,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ expected: "",
},
{
testName: "some commits",
@@ -61,12 +61,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit1", Sha: "sha1"},
{Name: "commit2", Sha: "sha2"},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 commit2
@@ -78,12 +78,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit1", Sha: "sha1", Tags: []string{"tag1", "tag2"}},
{Name: "commit2", Sha: "sha2"},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 tag1 tag2 commit1
sha2 commit2
@@ -103,14 +103,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "master", CommitHash: "sha3", Head: false},
{Name: "old-branch", CommitHash: "sha4", Head: false},
},
- currentBranchName: "current-branch",
- hasUpdateRefConfig: true,
- startIdx: 0,
- endIdx: 4,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ currentBranchName: "current-branch",
+ hasUpdateRefConfig: true,
+ startIdx: 0,
+ endIdx: 4,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 * commit2
@@ -128,14 +128,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "current-branch", CommitHash: "sha1", Head: true},
{Name: "other-branch", CommitHash: "sha1", Head: false},
},
- currentBranchName: "current-branch",
- hasUpdateRefConfig: true,
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ currentBranchName: "current-branch",
+ hasUpdateRefConfig: true,
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 * commit1
sha2 commit2
@@ -151,14 +151,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "current-branch", CommitHash: "sha1", Head: true},
{Name: "other-branch", CommitHash: "sha1", Head: false},
},
- currentBranchName: "current-branch",
- hasUpdateRefConfig: false,
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ currentBranchName: "current-branch",
+ hasUpdateRefConfig: false,
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 commit2
@@ -174,12 +174,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
branches: []*models.Branch{
{Name: "some-branch", CommitHash: "sha2"},
},
- startIdx: 0,
- endIdx: 3,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 3,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 * some-tag commit2
@@ -195,12 +195,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 ⏣─╮ commit1
sha2 ◯ │ commit2
@@ -218,13 +218,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -242,13 +242,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 1,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 1,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha2 pick commit2
sha3 ◯ <-- YOU ARE HERE --- commit3
@@ -265,13 +265,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 3,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 3,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha4 ◯ commit4
sha5 ◯ commit5
@@ -286,13 +286,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -307,13 +307,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 4,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 4,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha5 ◯ commit5
`),
@@ -327,13 +327,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}, Action: todo.Pick},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -346,13 +346,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}},
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
},
- startIdx: 0,
- endIdx: 3,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: false,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 3,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: false,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 ◯ commit2
@@ -365,15 +365,15 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit1", Sha: "sha1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"},
{Name: "commit2", Sha: "sha2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"},
},
- fullDescription: true,
- timeFormat: "2006-01-02",
- shortTimeFormat: "3:04PM",
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC),
+ fullDescription: true,
+ timeFormat: "2006-01-02",
+ shortTimeFormat: "3:04PM",
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC),
expected: formatExpected(`
sha1 2:03AM Jesse Duffield commit1
sha2 2019-12-20 Jesse Duffield commit2
@@ -406,14 +406,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
s.currentBranchName,
s.hasUpdateRefConfig,
s.fullDescription,
- s.cherryPickedCommitShaSet,
+ s.cherryPickedCommitHashSet,
s.diffName,
s.markedBaseCommit,
s.timeFormat,
s.shortTimeFormat,
s.now,
s.parseEmoji,
- s.selectedCommitSha,
+ s.selectedCommitHash,
s.startIdx,
s.endIdx,
s.showGraph,
diff --git a/pkg/gui/presentation/graph/graph.go b/pkg/gui/presentation/graph/graph.go
index 51a55acea..21530ac6b 100644
--- a/pkg/gui/presentation/graph/graph.go
+++ b/pkg/gui/presentation/graph/graph.go
@@ -32,7 +32,7 @@ type Pipe struct {
var highlightStyle = style.FgLightWhite.SetBold()
-func ContainsCommitSha(pipes []*Pipe, sha string) bool {
+func ContainsCommitHash(pipes []*Pipe, sha string) bool {
for _, pipe := range pipes {
if equalHashes(pipe.fromSha, sha) {
return true
@@ -49,13 +49,13 @@ func (self Pipe) right() int {
return max(self.fromPos, self.toPos)
}
-func RenderCommitGraph(commits []*models.Commit, selectedCommitSha string, getStyle func(c *models.Commit) style.TextStyle) []string {
+func RenderCommitGraph(commits []*models.Commit, selectedCommitHash string, getStyle func(c *models.Commit) style.TextStyle) []string {
pipeSets := GetPipeSets(commits, getStyle)
if len(pipeSets) == 0 {
return nil
}
- lines := RenderAux(pipeSets, commits, selectedCommitSha)