1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-19 12:12:42 +02:00

rename sha to hash 2

This commit is contained in:
pikomonde 2024-03-21 00:45:04 +07:00 committed by Stefan Haller
parent e6ef1642fa
commit 92aab21d3a
5 changed files with 21 additions and 21 deletions

View File

@ -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()

View File

@ -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
}

View File

@ -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

View File

@ -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 {

View File

@ -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
}