diff options
author | pikomonde <32364823+pikomonde@users.noreply.github.com> | 2024-03-21 02:23:10 +0700 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-04-12 08:33:47 +0200 |
commit | 19bef17042c4a9426afcefc89fcc9ce672fb2216 (patch) | |
tree | 82e2a33d3e9ca6bd89d69ef22fcc557c2afafd5f | |
parent | 170c4ecb8cca77be883f6eebcb46a7631f82ff65 (diff) |
rename sha to hash 10, last remaining sha (hopefully)
-rw-r--r-- | pkg/commands/git_commands/commit_test.go | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/rebase.go | 16 | ||||
-rw-r--r-- | pkg/commands/git_commands/stash_test.go | 8 | ||||
-rw-r--r-- | pkg/gui/controllers/bisect_controller.go | 10 | ||||
-rw-r--r-- | pkg/gui/presentation/reflog_commits.go | 6 |
5 files changed, 21 insertions, 21 deletions
diff --git a/pkg/commands/git_commands/commit_test.go b/pkg/commands/git_commands/commit_test.go index 43a8d0556..2e36636c5 100644 --- a/pkg/commands/git_commands/commit_test.go +++ b/pkg/commands/git_commands/commit_test.go @@ -365,7 +365,7 @@ func TestGetCommitMessageFromHistory(t *testing.T) { }, { "Default case to retrieve a commit in history", - oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"log", "-1", "--skip=2", "--pretty=%H"}, "sha3 \n", nil).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1", "sha3"}, `use generics to DRY up context code`, nil), + oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"log", "-1", "--skip=2", "--pretty=%H"}, "hash3 \n", nil).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1", "hash3"}, `use generics to DRY up context code`, nil), func(output string, err error) { assert.NoError(t, err) assert.Equal(t, "use generics to DRY up context code", output) diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go index fe5cf6037..f7b8b43dc 100644 --- a/pkg/commands/git_commands/rebase.go +++ b/pkg/commands/git_commands/rebase.go @@ -108,13 +108,13 @@ func (self *RebaseCommands) GenericAmend(commits []*models.Commit, index int, f func (self *RebaseCommands) MoveCommitsDown(commits []*models.Commit, startIdx int, endIdx int) error { baseHashOrRoot := getBaseHashOrRoot(commits, endIdx+2) - shas := lo.Map(commits[startIdx:endIdx+1], func(commit *models.Commit, _ int) string { + hashes := lo.Map(commits[startIdx:endIdx+1], func(commit *models.Commit, _ int) string { return commit.Hash }) return self.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{ baseHashOrRoot: baseHashOrRoot, - instruction: daemon.NewMoveTodosDownInstruction(shas), + instruction: daemon.NewMoveTodosDownInstruction(hashes), overrideEditor: true, }).Run() } @@ -122,13 +122,13 @@ func (self *RebaseCommands) MoveCommitsDown(commits []*models.Commit, startIdx i func (self *RebaseCommands) MoveCommitsUp(commits []*models.Commit, startIdx int, endIdx int) error { baseHashOrRoot := getBaseHashOrRoot(commits, endIdx+1) - shas := lo.Map(commits[startIdx:endIdx+1], func(commit *models.Commit, _ int) string { + hashes := lo.Map(commits[startIdx:endIdx+1], func(commit *models.Commit, _ int) string { return commit.Hash }) return self.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{ baseHashOrRoot: baseHashOrRoot, - instruction: daemon.NewMoveTodosUpInstruction(shas), + instruction: daemon.NewMoveTodosUpInstruction(hashes), overrideEditor: true, }).Run() } @@ -364,13 +364,13 @@ func (self *RebaseCommands) MoveTodosUp(commits []*models.Commit) error { // SquashAllAboveFixupCommits squashes all fixup! commits above the given one func (self *RebaseCommands) SquashAllAboveFixupCommits(commit *models.Commit) error { - shaOrRoot := commit.Hash + "^" + hashOrRoot := commit.Hash + "^" if commit.IsFirstCommit() { - shaOrRoot = "--root" + hashOrRoot = "--root" } cmdArgs := NewGitCmd("rebase"). - Arg("--interactive", "--rebase-merges", "--autostash", "--autosquash", shaOrRoot). + Arg("--interactive", "--rebase-merges", "--autostash", "--autosquash", hashOrRoot). ToArgv() return self.runSkipEditorCommand(self.cmd.New(cmdArgs)) @@ -503,7 +503,7 @@ func (self *RebaseCommands) DiscardOldFileChanges(commits []*models.Commit, comm return self.ContinueRebase() } -// CherryPickCommits begins an interactive rebase with the given shas being cherry picked onto HEAD +// CherryPickCommits begins an interactive rebase with the given hashes being cherry picked onto HEAD func (self *RebaseCommands) CherryPickCommits(commits []*models.Commit) error { commitLines := lo.Map(commits, func(commit *models.Commit, _ int) string { return fmt.Sprintf("%s %s", utils.ShortHash(commit.Hash), commit.Name) diff --git a/pkg/commands/git_commands/stash_test.go b/pkg/commands/git_commands/stash_test.go index fae0a0b5e..35b48e42d 100644 --- a/pkg/commands/git_commands/stash_test.go +++ b/pkg/commands/git_commands/stash_test.go @@ -154,7 +154,7 @@ func TestStashRename(t *testing.T) { index int message string expectedHashCmd []string - shaResult string + hashResult string expectedDropCmd []string expectedStoreCmd []string } @@ -165,7 +165,7 @@ func TestStashRename(t *testing.T) { index: 3, message: "New message", expectedHashCmd: []string{"rev-parse", "refs/stash@{3}"}, - shaResult: "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd\n", + hashResult: "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd\n", expectedDropCmd: []string{"stash", "drop", "stash@{3}"}, expectedStoreCmd: []string{"stash", "store", "-m", "New message", "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd"}, }, @@ -174,7 +174,7 @@ func TestStashRename(t *testing.T) { index: 4, message: "", expectedHashCmd: []string{"rev-parse", "refs/stash@{4}"}, - shaResult: "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd\n", + hashResult: "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd\n", expectedDropCmd: []string{"stash", "drop", "stash@{4}"}, expectedStoreCmd: []string{"stash", "store", "f0d0f20f2f61ffd6d6bfe0752deffa38845a3edd"}, }, @@ -184,7 +184,7 @@ func TestStashRename(t *testing.T) { s := s t.Run(s.testName, func(t *testing.T) { runner := oscommands.NewFakeRunner(t). - ExpectGitArgs(s.expectedHashCmd, s.shaResult, nil). + ExpectGitArgs(s.expectedHashCmd, s.hashResult, nil). ExpectGitArgs(s.expectedDropCmd, "", nil). ExpectGitArgs(s.expectedStoreCmd, "", nil) instance := buildStashCommands(commonDeps{runner: runner}) diff --git a/pkg/gui/controllers/bisect_controller.go b/pkg/gui/controllers/bisect_controller.go index f65f05e02..89cc6241f 100644 --- a/pkg/gui/controllers/bisect_controller.go +++ b/pkg/gui/controllers/bisect_controller.go @@ -79,8 +79,8 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c // use the selected commit in that case. bisecting := info.GetCurrentHash() != "" - shaToMark := lo.Ternary(bisecting, info.GetCurrentHash(), commit.Hash) - shortHashToMark := utils.ShortHash(shaToMark) + hashToMark := lo.Ternary(bisecting, info.GetCurrentHash(), commit.Hash) + shortHashToMark := utils.ShortHash(hashToMark) // For marking a commit as bad, when we're not already bisecting, we require // a single item selected, but once we are bisecting, it doesn't matter because @@ -95,7 +95,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c Label: fmt.Sprintf(self.c.Tr.Bisect.Mark, shortHashToMark, info.NewTerm()), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.BisectMark) - if err := self.c.Git().Bisect.Mark(shaToMark, info.NewTerm()); err != nil { + if err := self.c.Git().Bisect.Mark(hashToMark, info.NewTerm()); err != nil { return self.c.Error(err) } @@ -108,7 +108,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c Label: fmt.Sprintf(self.c.Tr.Bisect.Mark, shortHashToMark, info.OldTerm()), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.BisectMark) - if err := self.c.Git().Bisect.Mark(shaToMark, info.OldTerm()); err != nil { + if err := self.c.Git().Bisect.Mark(hashToMark, info.OldTerm()); err != nil { return self.c.Error(err) } @@ -121,7 +121,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c Label: fmt.Sprintf(self.c.Tr.Bisect.SkipCurrent, shortHashToMark), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.BisectSkip) - if err := self.c.Git().Bisect.Skip(shaToMark); err != nil { + if err := self.c.Git().Bisect.Skip(hashToMark); err != nil { return self.c.Error(err) } diff --git a/pkg/gui/presentation/reflog_commits.go b/pkg/gui/presentation/reflog_commits.go index b40f33b23..b97064d51 100644 --- a/pkg/gui/presentation/reflog_commits.go +++ b/pkg/gui/presentation/reflog_commits.go @@ -40,12 +40,12 @@ func reflogHashColor(cherryPicked, diffed bool) style.TextStyle { return theme.DiffTerminalColor } - shaColor := style.FgBlue + hashColor := style.FgBlue if cherryPicked { - shaColor = theme.CherryPickedCommitTextStyle + hashColor = theme.CherryPickedCommitTextStyle } - return shaColor + return hashColor } type reflogCommitDisplayAttributes struct { |