diff --git a/pkg/commands/git_commands/bisect.go b/pkg/commands/git_commands/bisect.go index 6d1d88530..61fe7a641 100644 --- a/pkg/commands/git_commands/bisect.go +++ b/pkg/commands/git_commands/bisect.go @@ -143,7 +143,7 @@ func (self *BisectCommands) IsDone() (bool, []string, error) { return false, nil, nil } - newSha := info.GetNewSha() + newSha := info.GetNewHash() if newSha == "" { return false, nil, nil } @@ -185,7 +185,7 @@ func (self *BisectCommands) IsDone() (bool, []string, error) { // render the commits from the bad commit. func (self *BisectCommands) ReachableFromStart(bisectInfo *BisectInfo) bool { cmdArgs := NewGitCmd("merge-base"). - Arg("--is-ancestor", bisectInfo.GetNewSha(), bisectInfo.GetStartSha()). + Arg("--is-ancestor", bisectInfo.GetNewHash(), bisectInfo.GetStartHash()). ToArgv() err := self.cmd.New(cmdArgs).DontLog().Run() diff --git a/pkg/commands/git_commands/bisect_info.go b/pkg/commands/git_commands/bisect_info.go index 39bd44949..c49d6866f 100644 --- a/pkg/commands/git_commands/bisect_info.go +++ b/pkg/commands/git_commands/bisect_info.go @@ -32,7 +32,7 @@ type BisectInfo struct { // map of commit hashes to their status statusMap map[string]BisectStatus - // the sha of the commit that's under test + // the hash of the commit that's under test current string } @@ -49,21 +49,21 @@ func NewNullBisectInfo() *BisectInfo { return &BisectInfo{started: false} } -func (self *BisectInfo) GetNewSha() string { - for sha, status := range self.statusMap { +func (self *BisectInfo) GetNewHash() string { + for hash, status := range self.statusMap { if status == BisectStatusNew { - return sha + return hash } } return "" } -func (self *BisectInfo) GetCurrentSha() string { +func (self *BisectInfo) GetCurrentHash() string { return self.current } -func (self *BisectInfo) GetStartSha() string { +func (self *BisectInfo) GetStartHash() string { return self.start } @@ -93,7 +93,7 @@ func (self *BisectInfo) Bisecting() bool { return false } - if self.GetNewSha() == "" { + if self.GetNewHash() == "" { return false } diff --git a/pkg/gui/controllers/bisect_controller.go b/pkg/gui/controllers/bisect_controller.go index 8e9bd77df..4fc2ec772 100644 --- a/pkg/gui/controllers/bisect_controller.go +++ b/pkg/gui/controllers/bisect_controller.go @@ -69,7 +69,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c // Originally we were allowing the user to, from the bisect menu, select whether // they were talking about the selected commit or the current bisect commit, // and that was a bit confusing (and required extra keypresses). - selectCurrentAfter := info.GetCurrentSha() == "" || info.GetCurrentSha() == commit.Hash + selectCurrentAfter := info.GetCurrentHash() == "" || info.GetCurrentHash() == commit.Hash // we need to wait to reselect if our bisect commits aren't ancestors of our 'start' // ref, because we'll be reloading our commits in that case. waitToReselect := selectCurrentAfter && !self.c.Git().Bisect.ReachableFromStart(info) @@ -78,8 +78,8 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c // not, we're still picking the initial commits before we really start, so // use the selected commit in that case. - bisecting := info.GetCurrentSha() != "" - shaToMark := lo.Ternary(bisecting, info.GetCurrentSha(), commit.Hash) + bisecting := info.GetCurrentHash() != "" + shaToMark := lo.Ternary(bisecting, info.GetCurrentHash(), commit.Hash) shortShaToMark := utils.ShortSha(shaToMark) // For marking a commit as bad, when we're not already bisecting, we require @@ -131,7 +131,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c Key: 's', }, } - if info.GetCurrentSha() != "" && info.GetCurrentSha() != commit.Hash { + if info.GetCurrentHash() != "" && info.GetCurrentHash() != commit.Hash { menuItems = append(menuItems, lo.ToPtr(types.MenuItem{ Label: fmt.Sprintf(self.c.Tr.Bisect.SkipSelected, commit.ShortSha()), OnPress: func() error { @@ -284,10 +284,10 @@ func (self *BisectController) afterBisectMarkRefresh(selectCurrent bool, waitToR func (self *BisectController) selectCurrentBisectCommit() { info := self.c.Git().Bisect.GetInfo() - if info.GetCurrentSha() != "" { + if info.GetCurrentHash() != "" { // find index of commit with that sha, move cursor to that. for i, commit := range self.c.Model().Commits { - if commit.Hash == info.GetCurrentSha() { + if commit.Hash == info.GetCurrentHash() { self.context().SetSelection(i) _ = self.context().HandleFocus(types.OnFocusOpts{}) break diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index a2c01e15d..34e390bde 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -290,10 +290,10 @@ func (self *RefreshHelper) determineCheckedOutBranchName() string { return strings.TrimPrefix(rebasedBranch, "refs/heads/") } - if bisectInfo := self.c.Git().Bisect.GetInfo(); bisectInfo.Bisecting() && bisectInfo.GetStartSha() != "" { + if bisectInfo := self.c.Git().Bisect.GetInfo(); bisectInfo.Bisecting() && bisectInfo.GetStartHash() != "" { // Likewise, when we're bisecting we're on a detached head as well. In // this case we read the branch name from the ".git/BISECT_START" file. - return bisectInfo.GetStartSha() + return bisectInfo.GetStartHash() } // In all other cases, get the branch name by asking git what branch is @@ -721,10 +721,10 @@ func (self *RefreshHelper) refForLog() string { // need to see if our bisect's current commit is reachable from our 'new' ref. if bisectInfo.Bisecting() && !self.c.Git().Bisect.ReachableFromStart(bisectInfo) { - return bisectInfo.GetNewSha() + return bisectInfo.GetNewHash() } - return bisectInfo.GetStartSha() + return bisectInfo.GetStartHash() } func (self *RefreshHelper) refreshView(context types.Context) error { diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go index a46911f4e..8823d508e 100644 --- a/pkg/gui/presentation/commits.go +++ b/pkg/gui/presentation/commits.go @@ -172,7 +172,7 @@ func getbisectBounds(commits []*models.Commit, bisectInfo *git_commands.BisectIn bisectBounds := &bisectBounds{} for i, commit := range commits { - if commit.Hash == bisectInfo.GetNewSha() { + if commit.Hash == bisectInfo.GetNewHash() { bisectBounds.newIndex = i } @@ -241,7 +241,7 @@ func getBisectStatus(index int, commitHash string, bisectInfo *git_commands.Bise return BisectStatusNone } - if bisectInfo.GetCurrentSha() == commitHash { + if bisectInfo.GetCurrentHash() == commitHash { return BisectStatusCurrent }