mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
renaming variable to CommitHash
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -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,
|
||||
|
@@ -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()
|
||||
|
@@ -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()
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user