From 84333eebc3be466b23627f6709ad6b000ddd21f1 Mon Sep 17 00:00:00 2001 From: pikomonde <32364823+pikomonde@users.noreply.github.com> Date: Wed, 20 Mar 2024 03:15:20 +0700 Subject: [PATCH] renaming variable to CommitHash --- pkg/commands/git_commands/bisect_info.go | 4 +- pkg/commands/git_commands/commit.go | 16 +- pkg/commands/git_commands/commit_loader.go | 8 +- pkg/commands/git_commands/working_tree.go | 4 +- .../git_commands/working_tree_test.go | 24 +- pkg/commands/hosting_service/definitions.go | 12 +- .../hosting_service/hosting_service.go | 8 +- pkg/gui/context/local_commits_context.go | 6 +- pkg/gui/context/sub_commits_context.go | 6 +- .../controllers/basic_commits_controller.go | 8 +- pkg/gui/controllers/helpers/host_helper.go | 6 +- pkg/gui/controllers/undo_controller.go | 24 +- pkg/gui/keybindings.go | 6 +- pkg/gui/presentation/commits.go | 26 +- pkg/gui/presentation/commits_test.go | 276 +++++++++--------- pkg/gui/presentation/graph/graph.go | 20 +- pkg/gui/presentation/reflog_commits.go | 4 +- pkg/i18n/chinese.go | 2 +- pkg/i18n/dutch.go | 2 +- pkg/i18n/english.go | 12 +- pkg/i18n/japanese.go | 6 +- pkg/i18n/korean.go | 6 +- pkg/i18n/polish.go | 6 +- pkg/i18n/russian.go | 6 +- pkg/i18n/traditional_chinese.go | 6 +- 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.*)/(?P.*?)(?:\.git)?$`, `^.*@.*:(?P.*)/(?P.*?)(?:\.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.*)/(?P.*)/(?P.*?)(?:\.git)?$`, `^https://.*@dev.azure.com/(?P.*?)/(?P.*?)/_git/(?P.*?)(?:\.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.*)/(?P.*?)(?:\.git)?$`, `^https://.*/scm/(?P.*)/(?P.*?)(?:\.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: 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) + lines := RenderAux(pipeSets, commits, selectedCommitHash) return lines } @@ -73,7 +73,7 @@ func GetPipeSets(commits []*models.Commit, getStyle func(c *models.Commit) style }) } -func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitSha string) []string { +func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitHash string) []string { maxProcs := runtime.GOMAXPROCS(0) // splitting up the rendering of the graph into multiple goroutines allows us to render the graph in parallel @@ -98,7 +98,7 @@ func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitSha s if k > 0 { prevCommit = commits[k-1] } - line := renderPipeSet(pipeSet, selectedCommitSha, prevCommit) + line := renderPipeSet(pipeSet, selectedCommitHash, prevCommit) innerLines = append(innerLines, line) } chunks[i] = innerLines @@ -282,7 +282,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod func renderPipeSet( pipes []*Pipe, - selectedCommitSha string, + selectedCommitHash string, prevCommit *models.Commit, ) string { maxPos := 0 @@ -329,10 +329,10 @@ func renderPipeSet( // we don't want to highlight two commits if they're contiguous. We only want // to highlight multiple things if there's an actual visible pipe involved. highlight := true - if prevCommit != nil && equalHashes(prevCommit.Sha, selectedCommitSha) { + if prevCommit != nil && equalHashes(prevCommit.Sha, selectedCommitHash) { highlight = false for _, pipe := range pipes { - if equalHashes(pipe.fromSha, selectedCommitSha) && (pipe.kind != TERMINATES || pipe.fromPos != pipe.toPos) { + if equalHashes(pipe.fromSha, selectedCommitHash) && (pipe.kind != TERMINATES || pipe.fromPos != pipe.toPos) { highlight = true } } @@ -341,7 +341,7 @@ func renderPipeSet( // so we have our commit pos again, now it's time to build the cells. // we'll handle the one that's sourced from our selected commit last so that it can override the other cells. selectedPipes, nonSelectedPipes := utils.Partition(pipes, func(pipe *Pipe) bool { - return highlight && equalHashes(pipe.fromSha, selectedCommitSha) + return highlight && equalHashes(pipe.fromSha, selectedCommitHash) }) for _, pipe := range nonSelectedPipes { @@ -385,7 +385,7 @@ func renderPipeSet( } func equalHashes(a, b string) bool { - // if our selectedCommitSha is an empty string we treat that as meaning there is no selected commit hash + // if our selectedCommitHash is an empty string we treat that as meaning there is no selected commit hash if a == "" || b == "" { return false } diff --git a/pkg/gui/presentation/reflog_commits.go b/pkg/gui/presentation/reflog_commits.go index cde774e46..e38a01126 100644 --- a/pkg/gui/presentation/reflog_commits.go +++ b/pkg/gui/presentation/reflog_commits.go @@ -12,7 +12,7 @@ import ( "github.com/samber/lo" ) -func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaSet *set.Set[string], diffName string, now time.Time, timeFormat string, shortTimeFormat string, parseEmoji bool) [][]string { +func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitHashSet *set.Set[string], diffName string, now time.Time, timeFormat string, shortTimeFormat string, parseEmoji bool) [][]string { var displayFunc func(*models.Commit, reflogCommitDisplayAttributes) []string if fullDescription { displayFunc = getFullDescriptionDisplayStringsForReflogCommit @@ -22,7 +22,7 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription return lo.Map(commits, func(commit *models.Commit, _ int) []string { diffed := commit.Sha == diffName - cherryPicked := cherryPickedCommitShaSet.Includes(commit.Sha) + cherryPicked := cherryPickedCommitHashSet.Includes(commit.Sha) return displayFunc(commit, reflogCommitDisplayAttributes{ cherryPicked: cherryPicked, diff --git a/pkg/i18n/chinese.go b/pkg/i18n/chinese.go index 5648c922f..f6071b398 100644 --- a/pkg/i18n/chinese.go +++ b/pkg/i18n/chinese.go @@ -355,7 +355,7 @@ func chineseTranslationSet() TranslationSet { // 实际视图 (actual view) 是附加视图 (extras view),未来,我打算为附加视图提供更多选项卡,但现在,上面的文本只需要提及“命令日志”这个部分 OpenCommandLogMenu: "打开命令日志菜单", ShowingGitDiff: "显示输出:", - CopyCommitShaToClipboard: "将提交的 SHA 复制到剪贴板", + CopyCommitHashToClipboard: "将提交的 SHA 复制到剪贴板", CopyCommitMessageToClipboard: "将提交消息复制到剪贴板", CopyBranchNameToClipboard: "将分支名称复制到剪贴板", CopyPathToClipboard: "将文件名复制到剪贴板", diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index 6eccd3f22..4db19c431 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -308,7 +308,7 @@ func dutchTranslationSet() TranslationSet { SwapDiff: "Keer diff richting om", ViewDiffingOptions: "Open diff menu", ShowingGitDiff: "Laat output zien voor:", - CopyCommitShaToClipboard: "Kopieer commit hash naar klembord", + CopyCommitHashToClipboard: "Kopieer commit hash naar klembord", CopyCommitMessageToClipboard: "Kopieer commit bericht naar klembord", CopyBranchNameToClipboard: "Kopieer branch name naar klembord", CopyPathToClipboard: "Kopieer de bestandsnaam naar het klembord", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 04da3eb17..9e728defd 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -571,8 +571,8 @@ type TranslationSet struct { OpenCommandLogMenuTooltip string ShowingGitDiff string CommitDiff string - CopyCommitShaToClipboard string - CommitSha string + CopyCommitHashToClipboard string + CommitHash string CommitURL string CopyCommitMessageToClipboard string CommitMessage string @@ -855,7 +855,7 @@ type Actions struct { CopyCommitMessageToClipboard string CopyCommitSubjectToClipboard string CopyCommitDiffToClipboard string - CopyCommitSHAToClipboard string + CopyCommitHashToClipboard string CopyCommitURLToClipboard string CopyCommitAuthorToClipboard string CopyCommitAttributeToClipboard string @@ -1534,8 +1534,8 @@ func EnglishTranslationSet() TranslationSet { OpenCommandLogMenuTooltip: "View options for the command log e.g. show/hide the command log and focus the command log.", ShowingGitDiff: "Showing output for:", CommitDiff: "Commit diff", - CopyCommitShaToClipboard: "Copy commit hash to clipboard", - CommitSha: "commit hash", + CopyCommitHashToClipboard: "Copy commit hash to clipboard", + CommitHash: "Commit hash", CommitURL: "Commit URL", CopyCommitMessageToClipboard: "Copy commit message to clipboard", CommitMessage: "Commit message", @@ -1772,7 +1772,7 @@ func EnglishTranslationSet() TranslationSet { CopyCommitMessageToClipboard: "Copy commit message to clipboard", CopyCommitSubjectToClipboard: "Copy commit subject to clipboard", CopyCommitDiffToClipboard: "Copy commit diff to clipboard", - CopyCommitSHAToClipboard: "Copy full commit hash to clipboard", + CopyCommitHashToClipboard: "Copy full commit hash to clipboard", CopyCommitURLToClipboard: "Copy commit URL to clipboard", CopyCommitAuthorToClipboard: "Copy commit author to clipboard", CopyCommitAttributeToClipboard: "Copy to clipboard", diff --git a/pkg/i18n/japanese.go b/pkg/i18n/japanese.go index bb709bece..dbc7a5dc6 100644 --- a/pkg/i18n/japanese.go +++ b/pkg/i18n/japanese.go @@ -367,8 +367,8 @@ func japaneseTranslationSet() TranslationSet { OpenCommandLogMenu: "コマンドログメニューを開く", // LcShowingGitDiff: "Showing output for:", CommitDiff: "コミットの差分", - CopyCommitShaToClipboard: "コミットのSHAをクリップボードにコピー", - CommitSha: "コミットのSHA", + CopyCommitHashToClipboard: "コミットのSHAをクリップボードにコピー", + CommitHash: "コミットのSHA", CommitURL: "コミットのURL", CopyCommitMessageToClipboard: "コミットメッセージをクリップボードにコピー", CommitMessage: "コミットメッセージ", @@ -496,7 +496,7 @@ func japaneseTranslationSet() TranslationSet { CreateAnnotatedTag: "注釈付きタグを作成", CopyCommitMessageToClipboard: "コミットメッセージをクリップボードにコピー", CopyCommitDiffToClipboard: "コミットの差分をクリップボードにコピー", - CopyCommitSHAToClipboard: "コミットSHAをクリップボードにコピー", + CopyCommitHashToClipboard: "コミットSHAをクリップボードにコピー", CopyCommitURLToClipboard: "コミットのURLをクリップボードにコピー", CopyCommitAuthorToClipboard: "コミットの作成者名をクリップボードにコピー", CopyCommitAttributeToClipboard: "クリップボードにコピー", diff --git a/pkg/i18n/korean.go b/pkg/i18n/korean.go index dd9ba31c8..3111e6b46 100644 --- a/pkg/i18n/korean.go +++ b/pkg/i18n/korean.go @@ -361,8 +361,8 @@ func koreanTranslationSet() TranslationSet { OpenCommandLogMenu: "명령어 로그 메뉴 열기", ShowingGitDiff: "Showing output for:", CommitDiff: "커밋의 iff", - CopyCommitShaToClipboard: "커밋 SHA를 클립보드에 복사", - CommitSha: "커밋 SHA", + CopyCommitHashToClipboard: "커밋 SHA를 클립보드에 복사", + CommitHash: "커밋 SHA", CommitURL: "커밋 URL", CopyCommitMessageToClipboard: "커밋 메시지를 클립보드에 복사", CommitMessage: "커밋 메시지", @@ -486,7 +486,7 @@ func koreanTranslationSet() TranslationSet { CreateAnnotatedTag: "Create annotated tag", CopyCommitMessageToClipboard: "커밋 메시지를 클립보드에 복사", CopyCommitDiffToClipboard: "커밋 diff를 클립보드에 복사", - CopyCommitSHAToClipboard: "커밋 SHA를 클립보드에 복사", + CopyCommitHashToClipboard: "커밋 SHA를 클립보드에 복사", CopyCommitURLToClipboard: "커밋 URL를 클립보드에 복사", CopyCommitAuthorToClipboard: "커밋 작성자를 클립보드에 복사", CopyCommitAttributeToClipboard: "클립보드에 복사", diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index a24d44ca2..e8d05c46f 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -548,8 +548,8 @@ func polishTranslationSet() TranslationSet { OpenCommandLogMenuTooltip: "Pokaż opcje dla dziennika poleceń, np. pokazywanie/ukrywanie dziennika poleceń i skupienie na dzienniku poleceń.", ShowingGitDiff: "Pokazuje wynik dla:", CommitDiff: "Różnice commita", - CopyCommitShaToClipboard: "Kopiuj SHA commita do schowka", - CommitSha: "SHA commita", + CopyCommitHashToClipboard: "Kopiuj SHA commita do schowka", + CommitHash: "SHA commita", CommitURL: "URL commita", CopyCommitMessageToClipboard: "Kopiuj wiadomość commita do schowka", CommitMessage: "Wiadomość commita", @@ -784,7 +784,7 @@ func polishTranslationSet() TranslationSet { CopyCommitMessageToClipboard: "Kopiuj wiadomość commita do schowka", CopyCommitSubjectToClipboard: "Kopiuj temat commita do schowka", CopyCommitDiffToClipboard: "Kopiuj różnice commita do schowka", - CopyCommitSHAToClipboard: "Kopiuj SHA commita do schowka", + CopyCommitHashToClipboard: "Kopiuj SHA commita do schowka", CopyCommitURLToClipboard: "Kopiuj URL commita do schowka", CopyCommitAuthorToClipboard: "Kopiuj autora commita do schowka", CopyCommitAttributeToClipboard: "Kopiuj do schowka", diff --git a/pkg/i18n/russian.go b/pkg/i18n/russian.go index 5378d774e..d0fe9a457 100644 --- a/pkg/i18n/russian.go +++ b/pkg/i18n/russian.go @@ -422,8 +422,8 @@ func RussianTranslationSet() TranslationSet { OpenCommandLogMenu: "Открыть меню журнала команд", ShowingGitDiff: "Показывает вывод для:", CommitDiff: "Разница коммита", - CopyCommitShaToClipboard: "Скопировать SHA коммита в буфер обмена", - CommitSha: "SHA коммита", + CopyCommitHashToClipboard: "Скопировать SHA коммита в буфер обмена", + CommitHash: "SHA коммита", CommitURL: "URL коммита", CopyCommitMessageToClipboard: "Скопировать сообщение коммита в буфер обмена", CommitMessage: "Полное сообщение коммита", @@ -579,7 +579,7 @@ func RussianTranslationSet() TranslationSet { CopyCommitMessageToClipboard: "Скопировать сообщение коммита в буфер обмена", CopyCommitSubjectToClipboard: "Скопировать тему коммита в буфер обмена", CopyCommitDiffToClipboard: "Скопировать сравнения коммита в буфер обмена", - CopyCommitSHAToClipboard: "Скопировать SHA коммита в буфер обмена", + CopyCommitHashToClipboard: "Скопировать SHA коммита в буфер обмена", CopyCommitURLToClipboard: "Скопировать URL коммита в буфер обмена", CopyCommitAuthorToClipboard: "Скопировать автора коммита в буфер обмена", CopyCommitAttributeToClipboard: "Скопировать в буфер обмена", diff --git a/pkg/i18n/traditional_chinese.go b/pkg/i18n/traditional_chinese.go index 56d2c99a0..e0e0c31ed 100644 --- a/pkg/i18n/traditional_chinese.go +++ b/pkg/i18n/traditional_chinese.go @@ -454,8 +454,8 @@ func traditionalChineseTranslationSet() TranslationSet { OpenCommandLogMenu: "開啟命令記錄選單", ShowingGitDiff: "顯示輸出:", CommitDiff: "提交差異", - CopyCommitShaToClipboard: "複製提交 SHA 到剪貼簿", - CommitSha: "提交 SHA", + CopyCommitHashToClipboard: "複製提交 SHA 到剪貼簿", + CommitHash: "提交 SHA", CommitURL: "提交 URL", CopyCommitMessageToClipboard: "複製提交訊息到剪貼簿", CommitMessage: "提交訊息", @@ -647,7 +647,7 @@ func traditionalChineseTranslationSet() TranslationSet { CreateAnnotatedTag: "建立附註標籤", CopyCommitMessageToClipboard: "將提交訊息複製到剪貼簿", CopyCommitDiffToClipboard: "將提交差異複製到剪貼簿", - CopyCommitSHAToClipboard: "將提交 SHA 複製到剪貼簿", + CopyCommitHashToClipboard: "將提交 SHA 複製到剪貼簿", CopyCommitURLToClipboard: "將提交 URL 複製到剪貼簿", CopyCommitAuthorToClipboard: "將提交作者複製到剪貼簿", CopyCommitAttributeToClipboard: "複製到剪貼簿",