summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpikomonde <32364823+pikomonde@users.noreply.github.com>2024-03-21 01:59:00 +0700
committerStefan Haller <stefan@haller-berlin.de>2024-04-12 08:33:47 +0200
commit05fb12b1d58a664ac2b9d392979d0f71490ea28a (patch)
tree3057bc3f716328e9c8d610c1bcace4f1bcd11d36
parent9cf1ca10a20e5897012c853887f8ce64c885cd84 (diff)
rename sha to hash 6, update short hash
-rw-r--r--pkg/app/entry_point.go2
-rw-r--r--pkg/commands/git_commands/rebase.go2
-rw-r--r--pkg/commands/models/commit.go4
-rw-r--r--pkg/gui/context/reflog_commits_context.go2
-rw-r--r--pkg/gui/controllers/bisect_controller.go8
-rw-r--r--pkg/gui/controllers/helpers/repos_helper.go2
-rw-r--r--pkg/gui/controllers/local_commits_controller.go2
-rw-r--r--pkg/gui/presentation/branches.go2
-rw-r--r--pkg/gui/presentation/commits.go2
-rw-r--r--pkg/gui/presentation/reflog_commits.go4
-rw-r--r--pkg/utils/formatting.go2
11 files changed, 16 insertions, 16 deletions
diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go
index fb19f06f6..baeb43ae5 100644
--- a/pkg/app/entry_point.go
+++ b/pkg/app/entry_point.go
@@ -263,7 +263,7 @@ func mergeBuildInfo(buildInfo *BuildInfo) {
buildInfo.Commit = revision.Value
// if lazygit was built from source we'll show the version as the
// abbreviated commit hash
- buildInfo.Version = utils.ShortSha(revision.Value)
+ buildInfo.Version = utils.ShortHash(revision.Value)
}
// if version hasn't been set we assume that neither has the date
diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go
index 50cadd8a3..e84afdc76 100644
--- a/pkg/commands/git_commands/rebase.go
+++ b/pkg/commands/git_commands/rebase.go
@@ -506,7 +506,7 @@ func (self *RebaseCommands) DiscardOldFileChanges(commits []*models.Commit, comm
// CherryPickCommits begins an interactive rebase with the given shas 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.ShortSha(commit.Hash), commit.Name)
+ return fmt.Sprintf("%s %s", utils.ShortHash(commit.Hash), commit.Name)
})
msg := utils.ResolvePlaceholderString(
self.Tr.Log.CherryPickCommits,
diff --git a/pkg/commands/models/commit.go b/pkg/commands/models/commit.go
index 9dae21850..a6b4af0ba 100644
--- a/pkg/commands/models/commit.go
+++ b/pkg/commands/models/commit.go
@@ -58,8 +58,8 @@ type Commit struct {
Parents []string
}
-func (c *Commit) ShortSha() string {
- return utils.ShortSha(c.Hash)
+func (c *Commit) ShortHash() string {
+ return utils.ShortHash(c.Hash)
}
func (c *Commit) FullRefName() string {
diff --git a/pkg/gui/context/reflog_commits_context.go b/pkg/gui/context/reflog_commits_context.go
index 5b3c72360..57ca7c4dc 100644
--- a/pkg/gui/context/reflog_commits_context.go
+++ b/pkg/gui/context/reflog_commits_context.go
@@ -22,7 +22,7 @@ func NewReflogCommitsContext(c *ContextCommon) *ReflogCommitsContext {
viewModel := NewFilteredListViewModel(
func() []*models.Commit { return c.Model().FilteredReflogCommits },
func(commit *models.Commit) []string {
- return []string{commit.ShortSha(), commit.Name}
+ return []string{commit.ShortHash(), commit.Name}
},
)
diff --git a/pkg/gui/controllers/bisect_controller.go b/pkg/gui/controllers/bisect_controller.go
index ddd2f9735..35327a3d6 100644
--- a/pkg/gui/controllers/bisect_controller.go
+++ b/pkg/gui/controllers/bisect_controller.go
@@ -80,7 +80,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c
bisecting := info.GetCurrentHash() != ""
shaToMark := lo.Ternary(bisecting, info.GetCurrentHash(), commit.Hash)
- shortShaToMark := utils.ShortSha(shaToMark)
+ shortShaToMark := utils.ShortHash(shaToMark)
// 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
@@ -133,7 +133,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c
}
if info.GetCurrentHash() != "" && info.GetCurrentHash() != commit.Hash {
menuItems = append(menuItems, lo.ToPtr(types.MenuItem{
- Label: fmt.Sprintf(self.c.Tr.Bisect.SkipSelected, commit.ShortSha()),
+ Label: fmt.Sprintf(self.c.Tr.Bisect.SkipSelected, commit.ShortHash()),
OnPress: func() error {
self.c.LogAction(self.c.Tr.Actions.BisectSkip)
if err := self.c.Git().Bisect.Skip(commit.Hash); err != nil {
@@ -165,7 +165,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo,
Title: self.c.Tr.Bisect.BisectMenuTitle,
Items: []*types.MenuItem{
{
- Label: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortSha(), info.NewTerm()),
+ Label: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortHash(), info.NewTerm()),
OnPress: func() error {
self.c.LogAction(self.c.Tr.Actions.StartBisect)
if err := self.c.Git().Bisect.Start(); err != nil {
@@ -182,7 +182,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo,
Key: 'b',
},
{
- Label: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortSha(), info.OldTerm()),
+ Label: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortHash(), info.OldTerm()),
OnPress: func() error {
self.c.LogAction(self.c.Tr.Actions.StartBisect)
if err := self.c.Git().Bisect.Start(); err != nil {
diff --git a/pkg/gui/controllers/helpers/repos_helper.go b/pkg/gui/controllers/helpers/repos_helper.go
index c4a00cb73..c2c177078 100644
--- a/pkg/gui/controllers/helpers/repos_helper.go
+++ b/pkg/gui/controllers/helpers/repos_helper.go
@@ -63,7 +63,7 @@ func (self *ReposHelper) getCurrentBranch(path string) string {
branchDisplay = strings.TrimPrefix(content, refsPrefix)
} else {
// detached HEAD state, displaying short SHA
- branchDisplay = utils.ShortSha(content)
+ branchDisplay = utils.ShortHash(content)
}
return branchDisplay, nil
}
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go
index e33d78022..8b4e388cb 100644
--- a/pkg/gui/controllers/local_commits_controller.go
+++ b/pkg/gui/controllers/local_commits_controller.go
@@ -782,7 +782,7 @@ func (self *LocalCommitsController) revert(commit *models.Commit) error {
Prompt: utils.ResolvePlaceholderString(
self.c.Tr.ConfirmRevertCommit,
map[string]string{
- "selectedCommit": commit.ShortSha(),
+ "selectedCommit": commit.ShortHash(),
}),
HandleConfirm: func() error {
self.c.LogAction(self.c.Tr.Actions.RevertCommit)
diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go
index 9d0625ea1..0abf2d4cd 100644
--- a/pkg/gui/presentation/branches.go
+++ b/pkg/gui/presentation/branches.go
@@ -106,7 +106,7 @@ func getBranchDisplayStrings(
}
if showCommitHash {
- res = append(res, utils.ShortSha(b.CommitHash))
+ res = append(res, utils.ShortHash(b.CommitHash))
}
res = append(res, coloredName)
diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go
index 8823d508e..357146126 100644
--- a/pkg/gui/presentation/commits.go
+++ b/pkg/gui/presentation/commits.go
@@ -373,7 +373,7 @@ func displayCommit(
} else if icons.IsIconEnabled() {
cols = append(cols, shaColor.Sprint(icons.IconForCommit(commit)))
}
- cols = append(cols, shaColor.Sprint(commit.ShortSha()))
+ cols = append(cols, shaColor.Sprint(commit.ShortHash()))
cols = append(cols, bisectString)
if fullDescription {
cols = append(cols, style.FgBlue.Sprint(
diff --git a/pkg/gui/presentation/reflog_commits.go b/pkg/gui/presentation/reflog_commits.go
index b520521cc..243fea1a3 100644
--- a/pkg/gui/presentation/reflog_commits.go
+++ b/pkg/gui/presentation/reflog_commits.go
@@ -64,7 +64,7 @@ func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, attrs ref
}
return []string{
- reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortSha()),
+ reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortHash()),
style.FgMagenta.Sprint(utils.UnixToDateSmart(attrs.now, c.UnixTimestamp, attrs.timeFormat, attrs.shortTimeFormat)),
theme.DefaultTextColor.Sprint(name),
}
@@ -77,7 +77,7 @@ func getDisplayStringsForReflogCommit(c *models.Commit, attrs reflogCommitDispla
}
return []string{
- reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortSha()),
+ reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortHash()),
theme.DefaultTextColor.Sprint(name),
}
}
diff --git a/pkg/utils/formatting.go b/pkg/utils/formatting.go
index ffc530068..139946ddb 100644
--- a/pkg/utils/formatting.go
+++ b/pkg/utils/formatting.go
@@ -177,7 +177,7 @@ func SafeTruncate(str string, limit int) string {
const COMMIT_HASH_SHORT_SIZE = 8
-func ShortSha(hash string) string {
+func ShortHash(hash string) string {
if len(hash) < COMMIT_HASH_SHORT_SIZE {
return hash
}