summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpikomonde <32364823+pikomonde@users.noreply.github.com>2024-03-20 03:15:20 +0700
committerStefan Haller <stefan@haller-berlin.de>2024-04-12 08:33:47 +0200
commit84333eebc3be466b23627f6709ad6b000ddd21f1 (patch)
tree0dc30763a0afb5abeabbe051e0c17771f4670b67
parent7f6eea2a55ee6e17660c893a9322d743c5016caf (diff)
renaming variable to CommitHash
-rw-r--r--pkg/commands/git_commands/bisect_info.go4
-rw-r--r--pkg/commands/git_commands/commit.go16
-rw-r--r--pkg/commands/git_commands/commit_loader.go8
-rw-r--r--pkg/commands/git_commands/working_tree.go4
-rw-r--r--pkg/commands/git_commands/working_tree_test.go24
-rw-r--r--pkg/commands/hosting_service/definitions.go12
-rw-r--r--pkg/commands/hosting_service/hosting_service.go8
-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
-rw-r--r--pkg/i18n/chinese.go2
-rw-r--r--pkg/i18n/dutch.go2
-rw-r--r--pkg/i18n/english.go12
-rw-r--r--pkg/i18n/japanese.go6
-rw-r--r--pkg/i18n/korean.go6
-rw-r--r--pkg/i18n/polish.go6
-rw-r--r--pkg/i18n/russian.go6
-rw-r--r--pkg/i18n/traditional_chinese.go6
25 files changed, 252 insertions, 252 deletions
diff --git a/pkg/commands/git_commands/bisect_info.go b/pkg/commands/git_commands/bisect_info.go
index bed5bd9db..39bd44949 100644
--- a/pkg/commands/git_commands/bisect_info.go
+++ b/pkg/commands/git_commands/bisect_info.go
@@ -67,8 +67,8 @@ func (self *BisectInfo) GetStartSha() string {
return self.start
}
-func (self *BisectInfo) Status(commitSha string) (BisectStatus, bool) {
- status, ok := self.statusMap[commitSha]
+func (self *BisectInfo) Status(commitHash string) (BisectStatus, bool) {
+ status, ok := self.statusMap[commitHash]
return status, ok
}
diff --git a/pkg/commands/git_commands/commit.go b/pkg/commands/git_commands/commit.go
index 693fe4eba..61b6cc2a1 100644
--- a/pkg/commands/git_commands/commit.go
+++ b/pkg/commands/git_commands/commit.go
@@ -155,9 +155,9 @@ func (self *CommitCommands) signoffFlag() string {
}
}
-func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error) {
+func (self *CommitCommands) GetCommitMessage(commitHash string) (string, error) {
cmdArgs := NewGitCmd("log").
- Arg("--format=%B", "--max-count=1", commitSha).
+ Arg("--format=%B", "--max-count=1", commitHash).
Config("log.showsignature=false").
ToArgv()
@@ -165,9 +165,9 @@ func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error) {
return strings.ReplaceAll(strings.TrimSpace(message), "\r\n", "\n"), err
}
-func (self *CommitCommands) GetCommitSubject(commitSha string) (string, error) {
+func (self *CommitCommands) GetCommitSubject(commitHash string) (string, error) {
cmdArgs := NewGitCmd("log").
- Arg("--format=%s", "--max-count=1", commitSha).
+ Arg("--format=%s", "--max-count=1", commitHash).
Config("log.showsignature=false").
ToArgv()
@@ -175,8 +175,8 @@ func (self *CommitCommands) GetCommitSubject(commitSha string) (string, error) {
return strings.TrimSpace(subject), err
}
-func (self *CommitCommands) GetCommitDiff(commitSha string) (string, error) {
- cmdArgs := NewGitCmd("show").Arg("--no-color", commitSha).ToArgv()
+func (self *CommitCommands) GetCommitDiff(commitHash string) (string, error) {
+ cmdArgs := NewGitCmd("show").Arg("--no-color", commitHash).ToArgv()
diff, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
return diff, err
@@ -187,9 +187,9 @@ type Author struct {
Email string
}
-func (self *CommitCommands) GetCommitAuthor(commitSha string) (Author, error) {
+func (self *CommitCommands) GetCommitAuthor(commitHash string) (Author, error) {
cmdArgs := NewGitCmd("show").
- Arg("--no-patch", "--pretty=format:'%an%x00%ae'", commitSha).
+ Arg("--no-patch", "--pretty=format:'%an%x00%ae'", commitHash).
ToArgv()
output, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go
index a666359eb..44d0cf55d 100644
--- a/pkg/commands/git_commands/commit_loader.go
+++ b/pkg/commands/git_commands/commit_loader.go
@@ -260,7 +260,7 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
return nil, nil
}
- commitShas := lo.FilterMap(commits, func(commit *models.Commit, _ int) (string, bool) {
+ commitHashes := lo.FilterMap(commits, func(commit *models.Commit, _ int) (string, bool) {
return commit.Sha, commit.Sha != ""
})
@@ -270,7 +270,7 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
NewGitCmd("show").
Config("log.showSignature=false").
Arg("--no-patch", "--oneline", "--abbrev=20", prettyFormat).
- Arg(commitShas...).
+ Arg(commitHashes...).
ToArgv(),
).DontLog()
@@ -337,9 +337,9 @@ func (self *CommitLoader) getRebasingCommits(rebaseMode enums.RebaseMode) []*mod
// See if the current commit couldn't be applied because it conflicted; if
// so, add a fake entry for it
- if conflictedCommitSha := self.getConflictedCommit(todos); conflictedCommitSha != "" {
+ if conflictedCommitHash := self.getConflictedCommit(todos); conflictedCommitHash != "" {
commits = append(commits, &models.Commit{
- Sha: conflictedCommitSha,
+ Sha: conflictedCommitHash,
Name: "",
Status: models.StatusRebasing,
Action: models.ActionConflict,
diff --git a/pkg/commands/git_commands/working_tree.go b/pkg/commands/git_commands/working_tree.go
index c3338650a..3346c4f35 100644
--- a/pkg/commands/git_commands/working_tree.go
+++ b/pkg/commands/git_commands/working_tree.go
@@ -313,8 +313,8 @@ func (self *WorkingTreeCommands) ShowFileDiffCmdObj(from string, to string, reve
}
// CheckoutFile checks out the file for the given commit
-func (self *WorkingTreeCommands) CheckoutFile(commitSha, fileName string) error {
- cmdArgs := NewGitCmd("checkout").Arg(commitSha, "--", fileName).
+func (self *WorkingTreeCommands) CheckoutFile(commitHash, fileName string) error {
+ cmdArgs := NewGitCmd("checkout").Arg(commitHash, "--", fileName).
ToArgv()
return self.cmd.New(cmdArgs).Run()
diff --git a/pkg/commands/git_commands/working_tree_test.go b/pkg/commands/git_commands/working_tree_test.go
index 08255e247..435048072 100644
--- a/pkg/commands/git_commands/working_tree_test.go
+++ b/pkg/commands/git_commands/working_tree_test.go
@@ -397,18 +397,18 @@ func TestWorkingTreeShowFileDiff(t *testing.T) {
func TestWorkingTreeCheckoutFile(t *testing.T) {
type scenario struct {
- testName string
- commitSha string
- fileName string
- runner *oscommands.FakeCmdObjRunner
- test func(error)
+ testName string
+ commitHash string
+ fileName string
+ runner *oscommands.FakeCmdObjRunner
+ test func(error)
}
scenarios := []scenario{
{
- testName: "typical case",
- commitSha: "11af912",
- fileName: "test999.txt",
+ testName: "typical case",
+ commitHash: "11af912",
+ fileName: "test999.txt",
runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"checkout", "11af912", "--", "test999.txt"}, "", nil),
test: func(err error) {
@@ -416,9 +416,9 @@ func TestWorkingTreeCheckoutFile(t *testing.T) {
},
},
{
- testName: "returns error if there is one",
- commitSha: "11af912",
- fileName: "test999.txt",
+ testName: "returns error if there is one",
+ commitHash: "11af912",
+ fileName: "test999.txt",
runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"checkout", "11af912", "--", "test999.txt"}, "", errors.New("error")),
test: func(err error) {
@@ -432,7 +432,7 @@ func TestWorkingTreeCheckoutFile(t *testing.T) {
t.Run(s.testName, func(t *testing.T) {
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
- s.test(instance.CheckoutFile(s.commitSha, s.fileName))
+ s.test(instance.CheckoutFile(s.commitHash, s.fileName))
s.runner.CheckForMissingCalls()
})
}
diff --git a/pkg/commands/hosting_service/definitions.go b/pkg/commands/hosting_service/definitions.go
index 63a1b818f..ff872cd8c 100644
--- a/pkg/commands/hosting_service/definitions.go
+++ b/pkg/commands/hosting_service/definitions.go
@@ -14,7 +14,7 @@ var githubServiceDef = ServiceDefinition{
provider: "github",
pullRequestURLIntoDefaultBranch: "/compare/{{.From}}?expand=1",
pullRequestURLIntoTargetBranch: "/compare/{{.To}}...{{.From}}?expand=1",
- commitURL: "/commit/{{.CommitSha}}",
+ commitURL: "/commit/{{.CommitHash}}",
regexStrings: defaultUrlRegexStrings,
repoURLTemplate: defaultRepoURLTemplate,
}
@@ -23,7 +23,7 @@ var bitbucketServiceDef = ServiceDefinition{
provider: "bitbucket",
pullRequestURLIntoDefaultBranch: "/pull-requests/new?source={{.From}}&t=1",
pullRequestURLIntoTargetBranch: "/pull-requests/new?source={{.From}}&dest={{.To}}&t=1",
- commitURL: "/commits/{{.CommitSha}}",
+ commitURL: "/commits/{{.CommitHash}}",
regexStrings: []string{
`^(?:https?|ssh)://.*/(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
`^.*@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
@@ -35,7 +35,7 @@ var gitLabServiceDef = ServiceDefinition{
provider: "gitlab",
pullRequestURLIntoDefaultBranch: "/-/merge_requests/new?merge_request[source_branch]={{.From}}",
pullRequestURLIntoTargetBranch: "/-/merge_requests/new?merge_request[source_branch]={{.From}}&merge_request[target_branch]={{.To}}",
- commitURL: "/-/commit/{{.CommitSha}}",
+ commitURL: "/-/commit/{{.CommitHash}}",
regexStrings: defaultUrlRegexStrings,
repoURLTemplate: defaultRepoURLTemplate,
}
@@ -44,7 +44,7 @@ var azdoServiceDef = ServiceDefinition{
provider: "azuredevops",
pullRequestURLIntoDefaultBranch: "/pullrequestcreate?sourceRef={{.From}}",
pullRequestURLIntoTargetBranch: "/pullrequestcreate?sourceRef={{.From}}&targetRef={{.To}}",
- commitURL: "/commit/{{.CommitSha}}",
+ commitURL: "/commit/{{.CommitHash}}",
regexStrings: []string{
`^git@ssh.dev.azure.com.*/(?P<org>.*)/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
`^https://.*@dev.azure.com/(?P<org>.*?)/(?P<project>.*?)/_git/(?P<repo>.*?)(?:\.git)?$`,
@@ -56,7 +56,7 @@ var bitbucketServerServiceDef = ServiceDefinition{
provider: "bitbucketServer",
pullRequestURLIntoDefaultBranch: "/pull-requests?create&sourceBranch={{.From}}",
pullRequestURLIntoTargetBranch: "/pull-requests?create&targetBranch={{.To}}&sourceBranch={{.From}}",
- commitURL: "/commits/{{.CommitSha}}",
+ commitURL: "/commits/{{.CommitHash}}",
regexStrings: []string{
`^ssh://git@.*/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
`^https://.*/scm/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
@@ -68,7 +68,7 @@ var giteaServiceDef = ServiceDefinition{
provider: "gitea",
pullRequestURLIntoDefaultBranch: "/compare/{{.From}}",
pullRequestURLIntoTargetBranch: "/compare/{{.To}}...{{.From}}",
- commitURL: "/commit/{{.CommitSha}}",
+ commitURL: "/commit/{{.CommitHash}}",
regexStrings: defaultUrlRegexStrings,
repoURLTemplate: defaultRepoURLTemplate,
}
diff --git a/pkg/commands/hosting_service/hosting_service.go b/pkg/commands/hosting_service/hosting_service.go
index 9cb997a0e..2e913b654 100644
--- a/pkg/commands/hosting_service/hosting_service.go
+++ b/pkg/commands/hosting_service/hosting_service.go
@@ -51,13 +51,13 @@ func (self *HostingServiceMgr) GetPullRequestURL(from string, to string) (string
}
}
-func (self *HostingServiceMgr) GetCommitURL(commitSha string) (string, error) {
+func (self *HostingServiceMgr) GetCommitURL(commitHash string) (string, error) {
gitService, err := self.getService()
if err != nil {
return "", err
}
- pullRequestURL := gitService.getCommitURL(commitSha)
+ pullRequestURL := gitService.getCommitURL(commitHash)
return pullRequestURL, nil
}
@@ -174,8 +174,8 @@ func (self *Service) getPullRequestURLIntoTargetBranch(from string, to string) s
return self.resolveUrl(self.pullRequestURLIntoTargetBranch, map[string]string{"From": from, "To": to})
}
-func (self *Service) getCommitURL(commitSha string) string {
- return self.resolveUrl(self.commitURL, map[string]string{"CommitSha": commitSha})
+func (self *Service) getCommitURL(commitHash string) string {
+ return self.resolveUrl(self.commitURL, map[string]string{"CommitHash": commitHash})
}
func (self *Service) resolveUrl(templateString string, args map[string]string) string {
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: