mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
renaming variable to CommitHash
This commit is contained in:
@ -67,8 +67,8 @@ func (self *BisectInfo) GetStartSha() string {
|
|||||||
return self.start
|
return self.start
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *BisectInfo) Status(commitSha string) (BisectStatus, bool) {
|
func (self *BisectInfo) Status(commitHash string) (BisectStatus, bool) {
|
||||||
status, ok := self.statusMap[commitSha]
|
status, ok := self.statusMap[commitHash]
|
||||||
return status, ok
|
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").
|
cmdArgs := NewGitCmd("log").
|
||||||
Arg("--format=%B", "--max-count=1", commitSha).
|
Arg("--format=%B", "--max-count=1", commitHash).
|
||||||
Config("log.showsignature=false").
|
Config("log.showsignature=false").
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
||||||
@ -165,9 +165,9 @@ func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error) {
|
|||||||
return strings.ReplaceAll(strings.TrimSpace(message), "\r\n", "\n"), err
|
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").
|
cmdArgs := NewGitCmd("log").
|
||||||
Arg("--format=%s", "--max-count=1", commitSha).
|
Arg("--format=%s", "--max-count=1", commitHash).
|
||||||
Config("log.showsignature=false").
|
Config("log.showsignature=false").
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
||||||
@ -175,8 +175,8 @@ func (self *CommitCommands) GetCommitSubject(commitSha string) (string, error) {
|
|||||||
return strings.TrimSpace(subject), err
|
return strings.TrimSpace(subject), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CommitCommands) GetCommitDiff(commitSha string) (string, error) {
|
func (self *CommitCommands) GetCommitDiff(commitHash string) (string, error) {
|
||||||
cmdArgs := NewGitCmd("show").Arg("--no-color", commitSha).ToArgv()
|
cmdArgs := NewGitCmd("show").Arg("--no-color", commitHash).ToArgv()
|
||||||
|
|
||||||
diff, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
diff, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
||||||
return diff, err
|
return diff, err
|
||||||
@ -187,9 +187,9 @@ type Author struct {
|
|||||||
Email string
|
Email string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CommitCommands) GetCommitAuthor(commitSha string) (Author, error) {
|
func (self *CommitCommands) GetCommitAuthor(commitHash string) (Author, error) {
|
||||||
cmdArgs := NewGitCmd("show").
|
cmdArgs := NewGitCmd("show").
|
||||||
Arg("--no-patch", "--pretty=format:'%an%x00%ae'", commitSha).
|
Arg("--no-patch", "--pretty=format:'%an%x00%ae'", commitHash).
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
||||||
output, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
output, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
||||||
|
@ -260,7 +260,7 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
|
|||||||
return nil, nil
|
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 != ""
|
return commit.Sha, commit.Sha != ""
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
|
|||||||
NewGitCmd("show").
|
NewGitCmd("show").
|
||||||
Config("log.showSignature=false").
|
Config("log.showSignature=false").
|
||||||
Arg("--no-patch", "--oneline", "--abbrev=20", prettyFormat).
|
Arg("--no-patch", "--oneline", "--abbrev=20", prettyFormat).
|
||||||
Arg(commitShas...).
|
Arg(commitHashes...).
|
||||||
ToArgv(),
|
ToArgv(),
|
||||||
).DontLog()
|
).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
|
// See if the current commit couldn't be applied because it conflicted; if
|
||||||
// so, add a fake entry for it
|
// so, add a fake entry for it
|
||||||
if conflictedCommitSha := self.getConflictedCommit(todos); conflictedCommitSha != "" {
|
if conflictedCommitHash := self.getConflictedCommit(todos); conflictedCommitHash != "" {
|
||||||
commits = append(commits, &models.Commit{
|
commits = append(commits, &models.Commit{
|
||||||
Sha: conflictedCommitSha,
|
Sha: conflictedCommitHash,
|
||||||
Name: "",
|
Name: "",
|
||||||
Status: models.StatusRebasing,
|
Status: models.StatusRebasing,
|
||||||
Action: models.ActionConflict,
|
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
|
// CheckoutFile checks out the file for the given commit
|
||||||
func (self *WorkingTreeCommands) CheckoutFile(commitSha, fileName string) error {
|
func (self *WorkingTreeCommands) CheckoutFile(commitHash, fileName string) error {
|
||||||
cmdArgs := NewGitCmd("checkout").Arg(commitSha, "--", fileName).
|
cmdArgs := NewGitCmd("checkout").Arg(commitHash, "--", fileName).
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
||||||
return self.cmd.New(cmdArgs).Run()
|
return self.cmd.New(cmdArgs).Run()
|
||||||
|
@ -397,18 +397,18 @@ func TestWorkingTreeShowFileDiff(t *testing.T) {
|
|||||||
|
|
||||||
func TestWorkingTreeCheckoutFile(t *testing.T) {
|
func TestWorkingTreeCheckoutFile(t *testing.T) {
|
||||||
type scenario struct {
|
type scenario struct {
|
||||||
testName string
|
testName string
|
||||||
commitSha string
|
commitHash string
|
||||||
fileName string
|
fileName string
|
||||||
runner *oscommands.FakeCmdObjRunner
|
runner *oscommands.FakeCmdObjRunner
|
||||||
test func(error)
|
test func(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios := []scenario{
|
scenarios := []scenario{
|
||||||
{
|
{
|
||||||
testName: "typical case",
|
testName: "typical case",
|
||||||
commitSha: "11af912",
|
commitHash: "11af912",
|
||||||
fileName: "test999.txt",
|
fileName: "test999.txt",
|
||||||
runner: oscommands.NewFakeRunner(t).
|
runner: oscommands.NewFakeRunner(t).
|
||||||
ExpectGitArgs([]string{"checkout", "11af912", "--", "test999.txt"}, "", nil),
|
ExpectGitArgs([]string{"checkout", "11af912", "--", "test999.txt"}, "", nil),
|
||||||
test: func(err error) {
|
test: func(err error) {
|
||||||
@ -416,9 +416,9 @@ func TestWorkingTreeCheckoutFile(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: "returns error if there is one",
|
testName: "returns error if there is one",
|
||||||
commitSha: "11af912",
|
commitHash: "11af912",
|
||||||
fileName: "test999.txt",
|
fileName: "test999.txt",
|
||||||
runner: oscommands.NewFakeRunner(t).
|
runner: oscommands.NewFakeRunner(t).
|
||||||
ExpectGitArgs([]string{"checkout", "11af912", "--", "test999.txt"}, "", errors.New("error")),
|
ExpectGitArgs([]string{"checkout", "11af912", "--", "test999.txt"}, "", errors.New("error")),
|
||||||
test: func(err error) {
|
test: func(err error) {
|
||||||
@ -432,7 +432,7 @@ func TestWorkingTreeCheckoutFile(t *testing.T) {
|
|||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
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()
|
s.runner.CheckForMissingCalls()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ var githubServiceDef = ServiceDefinition{
|
|||||||
provider: "github",
|
provider: "github",
|
||||||
pullRequestURLIntoDefaultBranch: "/compare/{{.From}}?expand=1",
|
pullRequestURLIntoDefaultBranch: "/compare/{{.From}}?expand=1",
|
||||||
pullRequestURLIntoTargetBranch: "/compare/{{.To}}...{{.From}}?expand=1",
|
pullRequestURLIntoTargetBranch: "/compare/{{.To}}...{{.From}}?expand=1",
|
||||||
commitURL: "/commit/{{.CommitSha}}",
|
commitURL: "/commit/{{.CommitHash}}",
|
||||||
regexStrings: defaultUrlRegexStrings,
|
regexStrings: defaultUrlRegexStrings,
|
||||||
repoURLTemplate: defaultRepoURLTemplate,
|
repoURLTemplate: defaultRepoURLTemplate,
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ var bitbucketServiceDef = ServiceDefinition{
|
|||||||
provider: "bitbucket",
|
provider: "bitbucket",
|
||||||
pullRequestURLIntoDefaultBranch: "/pull-requests/new?source={{.From}}&t=1",
|
pullRequestURLIntoDefaultBranch: "/pull-requests/new?source={{.From}}&t=1",
|
||||||
pullRequestURLIntoTargetBranch: "/pull-requests/new?source={{.From}}&dest={{.To}}&t=1",
|
pullRequestURLIntoTargetBranch: "/pull-requests/new?source={{.From}}&dest={{.To}}&t=1",
|
||||||
commitURL: "/commits/{{.CommitSha}}",
|
commitURL: "/commits/{{.CommitHash}}",
|
||||||
regexStrings: []string{
|
regexStrings: []string{
|
||||||
`^(?:https?|ssh)://.*/(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
`^(?:https?|ssh)://.*/(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
`^.*@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
`^.*@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
@ -35,7 +35,7 @@ var gitLabServiceDef = ServiceDefinition{
|
|||||||
provider: "gitlab",
|
provider: "gitlab",
|
||||||
pullRequestURLIntoDefaultBranch: "/-/merge_requests/new?merge_request[source_branch]={{.From}}",
|
pullRequestURLIntoDefaultBranch: "/-/merge_requests/new?merge_request[source_branch]={{.From}}",
|
||||||
pullRequestURLIntoTargetBranch: "/-/merge_requests/new?merge_request[source_branch]={{.From}}&merge_request[target_branch]={{.To}}",
|
pullRequestURLIntoTargetBranch: "/-/merge_requests/new?merge_request[source_branch]={{.From}}&merge_request[target_branch]={{.To}}",
|
||||||
commitURL: "/-/commit/{{.CommitSha}}",
|
commitURL: "/-/commit/{{.CommitHash}}",
|
||||||
regexStrings: defaultUrlRegexStrings,
|
regexStrings: defaultUrlRegexStrings,
|
||||||
repoURLTemplate: defaultRepoURLTemplate,
|
repoURLTemplate: defaultRepoURLTemplate,
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ var azdoServiceDef = ServiceDefinition{
|
|||||||
provider: "azuredevops",
|
provider: "azuredevops",
|
||||||
pullRequestURLIntoDefaultBranch: "/pullrequestcreate?sourceRef={{.From}}",
|
pullRequestURLIntoDefaultBranch: "/pullrequestcreate?sourceRef={{.From}}",
|
||||||
pullRequestURLIntoTargetBranch: "/pullrequestcreate?sourceRef={{.From}}&targetRef={{.To}}",
|
pullRequestURLIntoTargetBranch: "/pullrequestcreate?sourceRef={{.From}}&targetRef={{.To}}",
|
||||||
commitURL: "/commit/{{.CommitSha}}",
|
commitURL: "/commit/{{.CommitHash}}",
|
||||||
regexStrings: []string{
|
regexStrings: []string{
|
||||||
`^git@ssh.dev.azure.com.*/(?P<org>.*)/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
`^git@ssh.dev.azure.com.*/(?P<org>.*)/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
`^https://.*@dev.azure.com/(?P<org>.*?)/(?P<project>.*?)/_git/(?P<repo>.*?)(?:\.git)?$`,
|
`^https://.*@dev.azure.com/(?P<org>.*?)/(?P<project>.*?)/_git/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
@ -56,7 +56,7 @@ var bitbucketServerServiceDef = ServiceDefinition{
|
|||||||
provider: "bitbucketServer",
|
provider: "bitbucketServer",
|
||||||
pullRequestURLIntoDefaultBranch: "/pull-requests?create&sourceBranch={{.From}}",
|
pullRequestURLIntoDefaultBranch: "/pull-requests?create&sourceBranch={{.From}}",
|
||||||
pullRequestURLIntoTargetBranch: "/pull-requests?create&targetBranch={{.To}}&sourceBranch={{.From}}",
|
pullRequestURLIntoTargetBranch: "/pull-requests?create&targetBranch={{.To}}&sourceBranch={{.From}}",
|
||||||
commitURL: "/commits/{{.CommitSha}}",
|
commitURL: "/commits/{{.CommitHash}}",
|
||||||
regexStrings: []string{
|
regexStrings: []string{
|
||||||
`^ssh://git@.*/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
`^ssh://git@.*/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
`^https://.*/scm/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
`^https://.*/scm/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
@ -68,7 +68,7 @@ var giteaServiceDef = ServiceDefinition{
|
|||||||
provider: "gitea",
|
provider: "gitea",
|
||||||
pullRequestURLIntoDefaultBranch: "/compare/{{.From}}",
|
pullRequestURLIntoDefaultBranch: "/compare/{{.From}}",
|
||||||
pullRequestURLIntoTargetBranch: "/compare/{{.To}}...{{.From}}",
|
pullRequestURLIntoTargetBranch: "/compare/{{.To}}...{{.From}}",
|
||||||
commitURL: "/commit/{{.CommitSha}}",
|
commitURL: "/commit/{{.CommitHash}}",
|
||||||
regexStrings: defaultUrlRegexStrings,
|
regexStrings: defaultUrlRegexStrings,
|
||||||
repoURLTemplate: defaultRepoURLTemplate,
|
repoURLTemplate: defaultRepoURLTemplate,
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,13 @@ func (self *HostingServiceMgr) GetPullRequestURL(from string, to string) (string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *HostingServiceMgr) GetCommitURL(commitSha string) (string, error) {
|
func (self *HostingServiceMgr) GetCommitURL(commitHash string) (string, error) {
|
||||||
gitService, err := self.getService()
|
gitService, err := self.getService()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
pullRequestURL := gitService.getCommitURL(commitSha)
|
pullRequestURL := gitService.getCommitURL(commitHash)
|
||||||
|
|
||||||
return pullRequestURL, nil
|
return pullRequestURL, nil
|
||||||
}
|
}
|
||||||
@ -174,8 +174,8 @@ func (self *Service) getPullRequestURLIntoTargetBranch(from string, to string) s
|
|||||||
return self.resolveUrl(self.pullRequestURLIntoTargetBranch, map[string]string{"From": from, "To": to})
|
return self.resolveUrl(self.pullRequestURLIntoTargetBranch, map[string]string{"From": from, "To": to})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Service) getCommitURL(commitSha string) string {
|
func (self *Service) getCommitURL(commitHash string) string {
|
||||||
return self.resolveUrl(self.commitURL, map[string]string{"CommitSha": commitSha})
|
return self.resolveUrl(self.commitURL, map[string]string{"CommitHash": commitHash})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Service) resolveUrl(templateString string, args map[string]string) string {
|
func (self *Service) resolveUrl(templateString string, args map[string]string) string {
|
||||||
|
@ -29,12 +29,12 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {
|
|||||||
)
|
)
|
||||||
|
|
||||||
getDisplayStrings := func(startIdx int, endIdx int) [][]string {
|
getDisplayStrings := func(startIdx int, endIdx int) [][]string {
|
||||||
selectedCommitSha := ""
|
selectedCommitHash := ""
|
||||||
|
|
||||||
if c.CurrentContext().GetKey() == LOCAL_COMMITS_CONTEXT_KEY {
|
if c.CurrentContext().GetKey() == LOCAL_COMMITS_CONTEXT_KEY {
|
||||||
selectedCommit := viewModel.GetSelected()
|
selectedCommit := viewModel.GetSelected()
|
||||||
if selectedCommit != nil {
|
if selectedCommit != nil {
|
||||||
selectedCommitSha = selectedCommit.Sha
|
selectedCommitHash = selectedCommit.Sha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {
|
|||||||
c.UserConfig.Gui.ShortTimeFormat,
|
c.UserConfig.Gui.ShortTimeFormat,
|
||||||
time.Now(),
|
time.Now(),
|
||||||
c.UserConfig.Git.ParseEmoji,
|
c.UserConfig.Git.ParseEmoji,
|
||||||
selectedCommitSha,
|
selectedCommitHash,
|
||||||
startIdx,
|
startIdx,
|
||||||
endIdx,
|
endIdx,
|
||||||
shouldShowGraph(c),
|
shouldShowGraph(c),
|
||||||
|
@ -44,11 +44,11 @@ func NewSubCommitsContext(
|
|||||||
return [][]string{}
|
return [][]string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedCommitSha := ""
|
selectedCommitHash := ""
|
||||||
if c.CurrentContext().GetKey() == SUB_COMMITS_CONTEXT_KEY {
|
if c.CurrentContext().GetKey() == SUB_COMMITS_CONTEXT_KEY {
|
||||||
selectedCommit := viewModel.GetSelected()
|
selectedCommit := viewModel.GetSelected()
|
||||||
if selectedCommit != nil {
|
if selectedCommit != nil {
|
||||||
selectedCommitSha = selectedCommit.Sha
|
selectedCommitHash = selectedCommit.Sha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
branches := []*models.Branch{}
|
branches := []*models.Branch{}
|
||||||
@ -70,7 +70,7 @@ func NewSubCommitsContext(
|
|||||||
c.UserConfig.Gui.ShortTimeFormat,
|
c.UserConfig.Gui.ShortTimeFormat,
|
||||||
time.Now(),
|
time.Now(),
|
||||||
c.UserConfig.Git.ParseEmoji,
|
c.UserConfig.Git.ParseEmoji,
|
||||||
selectedCommitSha,
|
selectedCommitHash,
|
||||||
startIdx,
|
startIdx,
|
||||||
endIdx,
|
endIdx,
|
||||||
// Don't show the graph in the left/right view; we'd like to, but
|
// Don't show the graph in the left/right view; we'd like to, but
|
||||||
|
@ -125,9 +125,9 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
|
|||||||
Title: self.c.Tr.Actions.CopyCommitAttributeToClipboard,
|
Title: self.c.Tr.Actions.CopyCommitAttributeToClipboard,
|
||||||
Items: []*types.MenuItem{
|
Items: []*types.MenuItem{
|
||||||
{
|
{
|
||||||
Label: self.c.Tr.CommitSha,
|
Label: self.c.Tr.CommitHash,
|
||||||
OnPress: func() error {
|
OnPress: func() error {
|
||||||
return self.copyCommitSHAToClipboard(commit)
|
return self.copyCommitHashToClipboard(commit)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -169,8 +169,8 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *BasicCommitsController) copyCommitSHAToClipboard(commit *models.Commit) error {
|
func (self *BasicCommitsController) copyCommitHashToClipboard(commit *models.Commit) error {
|
||||||
self.c.LogAction(self.c.Tr.Actions.CopyCommitSHAToClipboard)
|
self.c.LogAction(self.c.Tr.Actions.CopyCommitHashToClipboard)
|
||||||
if err := self.c.OS().CopyToClipboard(commit.Sha); err != nil {
|
if err := self.c.OS().CopyToClipboard(commit.Sha); err != nil {
|
||||||
return self.c.Error(err)
|
return self.c.Error(err)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
type IHostHelper interface {
|
type IHostHelper interface {
|
||||||
GetPullRequestURL(from string, to string) (string, error)
|
GetPullRequestURL(from string, to string) (string, error)
|
||||||
GetCommitURL(commitSha string) (string, error)
|
GetCommitURL(commitHash string) (string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostHelper struct {
|
type HostHelper struct {
|
||||||
@ -31,12 +31,12 @@ func (self *HostHelper) GetPullRequestURL(from string, to string) (string, error
|
|||||||
return mgr.GetPullRequestURL(from, to)
|
return mgr.GetPullRequestURL(from, to)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *HostHelper) GetCommitURL(commitSha string) (string, error) {
|
func (self *HostHelper) GetCommitURL(commitHash string) (string, error) {
|
||||||
mgr, err := self.getHostingServiceMgr()
|
mgr, err := self.getHostingServiceMgr()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return mgr.GetCommitURL(commitSha)
|
return mgr.GetCommitURL(commitHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// getting this on every request rather than storing it in state in case our remoteURL changes
|
// getting this on every request rather than storing it in state in case our remoteURL changes
|
||||||
|
@ -181,34 +181,34 @@ func (self *UndoController) reflogRedo() error {
|
|||||||
func (self *UndoController) parseReflogForActions(onUserAction func(counter int, action reflogAction) (bool, error)) error {
|
func (self *UndoController) parseReflogForActions(onUserAction func(counter int, action reflogAction) (bool, error)) error {
|
||||||
counter := 0
|
counter := 0
|
||||||
reflogCommits := self.c.Model().FilteredReflogCommits
|
reflogCommits := self.c.Model().FilteredReflogCommits
|
||||||
rebaseFinishCommitSha := ""
|
rebaseFinishCommitHash := ""
|
||||||
var action *reflogAction
|
var action *reflogAction
|
||||||
for reflogCommitIdx, reflogCommit := range reflogCommits {
|
for reflogCommitIdx, reflogCommit := range reflogCommits {
|
||||||
action = nil
|
action = nil
|
||||||
|
|
||||||
prevCommitSha := ""
|
prevCommitHash := ""
|
||||||
if len(reflogCommits)-1 >= reflogCommitIdx+1 {
|
if len(reflogCommits)-1 >= reflogCommitIdx+1 {
|
||||||
prevCommitSha = reflogCommits[reflogCommitIdx+1].Sha
|
prevCommitHash = reflogCommits[reflogCommitIdx+1].Sha
|
||||||
}
|
}
|
||||||
|
|
||||||
if rebaseFinishCommitSha == "" {
|
if rebaseFinishCommitHash == "" {
|
||||||
if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^\[lazygit undo\]`); ok {
|
if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^\[lazygit undo\]`); ok {
|
||||||
counter++
|
counter++
|
||||||
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^\[lazygit redo\]`); ok {
|
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^\[lazygit redo\]`); ok {
|
||||||
counter--
|
counter--
|
||||||
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(abort\)|^rebase (-i )?\(finish\)`); ok {
|
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(abort\)|^rebase (-i )?\(finish\)`); ok {
|
||||||
rebaseFinishCommitSha = reflogCommit.Sha
|
rebaseFinishCommitHash = reflogCommit.Sha
|
||||||
} else if ok, match := utils.FindStringSubmatch(reflogCommit.Name, `^checkout: moving from ([\S]+) to ([\S]+)`); ok {
|
} else if ok, match := utils.FindStringSubmatch(reflogCommit.Name, `^checkout: moving from ([\S]+) to ([\S]+)`); ok {
|
||||||
action = &reflogAction{kind: CHECKOUT, from: match[1], to: match[2]}
|
action = &reflogAction{kind: CHECKOUT, from: match[1], to: match[2]}
|
||||||
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^commit|^reset: moving to|^pull`); ok {
|
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^commit|^reset: moving to|^pull`); ok {
|
||||||
action = &reflogAction{kind: COMMIT, from: prevCommitSha, to: reflogCommit.Sha}
|
action = &reflogAction{kind: COMMIT, from: prevCommitHash, to: reflogCommit.Sha}
|
||||||
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(start\)`); ok {
|
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(start\)`); ok {
|
||||||
// if we're here then we must be currently inside an interactive rebase
|
// if we're here then we must be currently inside an interactive rebase
|
||||||
action = &reflogAction{kind: CURRENT_REBASE, from: prevCommitSha}
|
action = &reflogAction{kind: CURRENT_REBASE, from: prevCommitHash}
|
||||||
}
|
}
|
||||||
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(start\)`); ok {
|
} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(start\)`); ok {
|
||||||
action = &reflogAction{kind: REBASE, from: prevCommitSha, to: rebaseFinishCommitSha}
|
action = &reflogAction{kind: REBASE, from: prevCommitHash, to: rebaseFinishCommitHash}
|
||||||
rebaseFinishCommitSha = ""
|
rebaseFinishCommitHash = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if action != nil {
|
if action != nil {
|
||||||
@ -232,9 +232,9 @@ type hardResetOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only to be used in the undo flow for now (does an autostash)
|
// only to be used in the undo flow for now (does an autostash)
|
||||||
func (self *UndoController) hardResetWithAutoStash(commitSha string, options hardResetOptions) error {
|
func (self *UndoController) hardResetWithAutoStash(commitHash string, options hardResetOptions) error {
|
||||||
reset := func() error {
|
reset := func() error {
|
||||||
if err := self.c.Helpers().Refs.ResetToRef(commitSha, "hard", options.EnvVars); err != nil {
|
if err := self.c.Helpers().Refs.ResetToRef(commitHash, "hard", options.EnvVars); err != nil {
|
||||||
return self.c.Error(err)
|
return self.c.Error(err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -249,7 +249,7 @@ func (self *UndoController) hardResetWithAutoStash(commitSha string, options har
|
|||||||
Prompt: self.c.Tr.AutoStashPrompt,
|
Prompt: self.c.Tr.AutoStashPrompt,
|
||||||
HandleConfirm: func() error {
|
HandleConfirm: func() error {
|
||||||
return self.c.WithWaitingStatus(options.WaitingStatus, func(gocui.Task) error {
|
return self.c.WithWaitingStatus(options.WaitingStatus, func(gocui.Task) error {
|
||||||
if err := self.c.Git().Stash.Push(self.c.Tr.StashPrefix + commitSha); err != nil {
|
if err := self.c.Git().Stash.Push(self.c.Tr.StashPrefix + commitHash); err != nil {
|
||||||
return self.c.Error(err)
|
return self.c.Error(err)
|
||||||
}
|
}
|
||||||
if err := reset(); err != nil {
|
if err := reset(); err != nil {
|
||||||
|
@ -148,7 +148,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
|||||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||||
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
|
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
|
||||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||||
Description: self.c.Tr.CopyCommitShaToClipboard,
|
Description: self.c.Tr.CopyCommitHashToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
@ -161,14 +161,14 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
|||||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||||
Description: self.c.Tr.CopyCommitShaToClipboard,
|
Description: self.c.Tr.CopyCommitHashToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "subCommits",
|
ViewName: "subCommits",
|
||||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||||
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
|
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
|
||||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||||
Description: self.c.Tr.CopyCommitShaToClipboard,
|
Description: self.c.Tr.CopyCommitHashToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "information",
|
ViewName: "information",
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type pipeSetCacheKey struct {
|
type pipeSetCacheKey struct {
|
||||||
commitSha string
|
commitHash string
|
||||||
commitCount int
|
commitCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,14 +43,14 @@ func GetCommitListDisplayStrings(
|
|||||||
currentBranchName string,
|
currentBranchName string,
|
||||||
hasRebaseUpdateRefsConfig bool,
|
hasRebaseUpdateRefsConfig bool,
|
||||||
fullDescription bool,
|
fullDescription bool,
|
||||||
cherryPickedCommitShaSet *set.Set[string],
|
cherryPickedCommitHashSet *set.Set[string],
|
||||||
diffName string,
|
diffName string,
|
||||||
markedBaseCommit string,
|
markedBaseCommit string,
|
||||||
timeFormat string,
|
timeFormat string,
|
||||||
shortTimeFormat string,
|
shortTimeFormat string,
|
||||||
now time.Time,
|
now time.Time,
|
||||||
parseEmoji bool,
|
parseEmoji bool,
|
||||||
selectedCommitSha string,
|
selectedCommitHash string,
|
||||||
startIdx int,
|
startIdx int,
|
||||||
endIdx int,
|
endIdx int,
|
||||||
showGraph bool,
|
showGraph bool,
|
||||||
@ -89,7 +89,7 @@ func GetCommitListDisplayStrings(
|
|||||||
graphLines := graph.RenderAux(
|
graphLines := graph.RenderAux(
|
||||||
graphPipeSets,
|
graphPipeSets,
|
||||||
graphCommits,
|
graphCommits,
|
||||||
selectedCommitSha,
|
selectedCommitHash,
|
||||||
)
|
)
|
||||||
getGraphLine = func(idx int) string {
|
getGraphLine = func(idx int) string {
|
||||||
if idx >= graphOffset {
|
if idx >= graphOffset {
|
||||||
@ -146,7 +146,7 @@ func GetCommitListDisplayStrings(
|
|||||||
commit,
|
commit,
|
||||||
branchHeadsToVisualize,
|
branchHeadsToVisualize,
|
||||||
hasRebaseUpdateRefsConfig,
|
hasRebaseUpdateRefsConfig,
|
||||||
cherryPickedCommitShaSet,
|
cherryPickedCommitHashSet,
|
||||||
isMarkedBaseCommit,
|
isMarkedBaseCommit,
|
||||||
willBeRebased,
|
willBeRebased,
|
||||||
diffName,
|
diffName,
|
||||||
@ -203,7 +203,7 @@ func loadPipesets(commits []*models.Commit) [][]*graph.Pipe {
|
|||||||
// given that our cache key is a commit hash and a commit count, it's very important that we don't actually try to render pipes
|
// given that our cache key is a commit hash and a commit count, it's very important that we don't actually try to render pipes
|
||||||
// when dealing with things like filtered commits.
|
// when dealing with things like filtered commits.
|
||||||
cacheKey := pipeSetCacheKey{
|
cacheKey := pipeSetCacheKey{
|
||||||
commitSha: commits[0].Sha,
|
commitHash: commits[0].Sha,
|
||||||
commitCount: len(commits),
|
commitCount: len(commits),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,16 +236,16 @@ const (
|
|||||||
BisectStatusCurrent
|
BisectStatusCurrent
|
||||||
)
|
)
|
||||||
|
|
||||||
func getBisectStatus(index int, commitSha string, bisectInfo *git_commands.BisectInfo, bisectBounds *bisectBounds) BisectStatus {
|
func getBisectStatus(index int, commitHash string, bisectInfo *git_commands.BisectInfo, bisectBounds *bisectBounds) BisectStatus {
|
||||||
if !bisectInfo.Started() {
|
if !bisectInfo.Started() {
|
||||||
return BisectStatusNone
|
return BisectStatusNone
|
||||||
}
|
}
|
||||||
|
|
||||||
if bisectInfo.GetCurrentSha() == commitSha {
|
if bisectInfo.GetCurrentSha() == commitHash {
|
||||||
return BisectStatusCurrent
|
return BisectStatusCurrent
|
||||||
}
|
}
|
||||||
|
|
||||||
status, ok := bisectInfo.Status(commitSha)
|
status, ok := bisectInfo.Status(commitHash)
|
||||||
if ok {
|
if ok {
|
||||||
switch status {
|
switch status {
|
||||||
case git_commands.BisectStatusNew:
|
case git_commands.BisectStatusNew:
|
||||||
@ -298,7 +298,7 @@ func displayCommit(
|
|||||||
commit *models.Commit,
|
commit *models.Commit,
|
||||||
branchHeadsToVisualize *set.Set[string],
|
branchHeadsToVisualize *set.Set[string],
|
||||||
hasRebaseUpdateRefsConfig bool,
|
hasRebaseUpdateRefsConfig bool,
|
||||||
cherryPickedCommitShaSet *set.Set[string],
|
cherryPickedCommitHashSet *set.Set[string],
|
||||||
isMarkedBaseCommit bool,
|
isMarkedBaseCommit bool,
|
||||||
willBeRebased bool,
|
willBeRebased bool,
|
||||||
diffName string,
|
diffName string,
|
||||||
@ -312,7 +312,7 @@ func displayCommit(
|
|||||||
bisectInfo *git_commands.BisectInfo,
|
bisectInfo *git_commands.BisectInfo,
|
||||||
isYouAreHereCommit bool,
|
isYouAreHereCommit bool,
|
||||||
) []string {
|
) []string {
|
||||||
shaColor := getShaColor(commit, diffName, cherryPickedCommitShaSet, bisectStatus, bisectInfo)
|
shaColor := getShaColor(commit, diffName, cherryPickedCommitHashSet, bisectStatus, bisectInfo)
|
||||||
bisectString := getBisectStatusText(bisectStatus, bisectInfo)
|
bisectString := getBisectStatusText(bisectStatus, bisectInfo)
|
||||||
|
|
||||||
actionString := ""
|
actionString := ""
|
||||||
@ -413,7 +413,7 @@ func getBisectStatusColor(status BisectStatus) style.TextStyle {
|
|||||||
func getShaColor(
|
func getShaColor(
|
||||||
commit *models.Commit,
|
commit *models.Commit,
|
||||||
diffName string,
|
diffName string,
|
||||||
cherryPickedCommitShaSet *set.Set[string],
|
cherryPickedCommitHashSet *set.Set[string],
|
||||||
bisectStatus BisectStatus,
|
bisectStatus BisectStatus,
|
||||||
bisectInfo *git_commands.BisectInfo,
|
bisectInfo *git_commands.BisectInfo,
|
||||||
) style.TextStyle {
|
) style.TextStyle {
|
||||||
@ -439,7 +439,7 @@ func getShaColor(
|
|||||||
|
|
||||||
if diffed {
|
if diffed {
|
||||||
shaColor = theme.DiffTerminalColor
|
shaColor = theme.DiffTerminalColor
|
||||||
} else if cherryPickedCommitShaSet.Includes(commit.Sha) {
|
} else if cherryPickedCommitHashSet.Includes(commit.Sha) {
|
||||||
shaColor = theme.CherryPickedCommitTextStyle
|
shaColor = theme.CherryPickedCommitTextStyle
|
||||||
} else if commit.Divergence == models.DivergenceRight && commit.Status != models.StatusMerged {
|
} else if commit.Divergence == models.DivergenceRight && commit.Status != models.StatusMerged {
|
||||||
shaColor = style.FgBlue
|
shaColor = style.FgBlue
|
||||||
|
@ -22,38 +22,38 @@ func formatExpected(expected string) string {
|
|||||||
|
|
||||||
func TestGetCommitListDisplayStrings(t *testing.T) {
|
func TestGetCommitListDisplayStrings(t *testing.T) {
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
testName string
|
testName string
|
||||||
commits []*models.Commit
|
commits []*models.Commit
|
||||||
branches []*models.Branch
|
branches []*models.Branch
|
||||||
currentBranchName string
|
currentBranchName string
|
||||||
hasUpdateRefConfig bool
|
hasUpdateRefConfig bool
|
||||||
fullDescription bool
|
fullDescription bool
|
||||||
cherryPickedCommitShaSet *set.Set[string]
|
cherryPickedCommitHashSet *set.Set[string]
|
||||||
markedBaseCommit string
|
markedBaseCommit string
|
||||||
diffName string
|
diffName string
|
||||||
timeFormat string
|
timeFormat string
|
||||||
shortTimeFormat string
|
shortTimeFormat string
|
||||||
now time.Time
|
now time.Time
|
||||||
parseEmoji bool
|
parseEmoji bool
|
||||||
selectedCommitSha string
|
selectedCommitHash string
|
||||||
startIdx int
|
startIdx int
|
||||||
endIdx int
|
endIdx int
|
||||||
showGraph bool
|
showGraph bool
|
||||||
bisectInfo *git_commands.BisectInfo
|
bisectInfo *git_commands.BisectInfo
|
||||||
showYouAreHereLabel bool
|
showYouAreHereLabel bool
|
||||||
expected string
|
expected string
|
||||||
focus bool
|
focus bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
testName: "no commits",
|
testName: "no commits",
|
||||||
commits: []*models.Commit{},
|
commits: []*models.Commit{},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 1,
|
endIdx: 1,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: "",
|
expected: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: "some commits",
|
testName: "some commits",
|
||||||
@ -61,12 +61,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit1", Sha: "sha1"},
|
{Name: "commit1", Sha: "sha1"},
|
||||||
{Name: "commit2", Sha: "sha2"},
|
{Name: "commit2", Sha: "sha2"},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 2,
|
endIdx: 2,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 commit1
|
sha1 commit1
|
||||||
sha2 commit2
|
sha2 commit2
|
||||||
@ -78,12 +78,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit1", Sha: "sha1", Tags: []string{"tag1", "tag2"}},
|
{Name: "commit1", Sha: "sha1", Tags: []string{"tag1", "tag2"}},
|
||||||
{Name: "commit2", Sha: "sha2"},
|
{Name: "commit2", Sha: "sha2"},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 2,
|
endIdx: 2,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 tag1 tag2 commit1
|
sha1 tag1 tag2 commit1
|
||||||
sha2 commit2
|
sha2 commit2
|
||||||
@ -103,14 +103,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "master", CommitHash: "sha3", Head: false},
|
{Name: "master", CommitHash: "sha3", Head: false},
|
||||||
{Name: "old-branch", CommitHash: "sha4", Head: false},
|
{Name: "old-branch", CommitHash: "sha4", Head: false},
|
||||||
},
|
},
|
||||||
currentBranchName: "current-branch",
|
currentBranchName: "current-branch",
|
||||||
hasUpdateRefConfig: true,
|
hasUpdateRefConfig: true,
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 4,
|
endIdx: 4,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 commit1
|
sha1 commit1
|
||||||
sha2 * commit2
|
sha2 * commit2
|
||||||
@ -128,14 +128,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "current-branch", CommitHash: "sha1", Head: true},
|
{Name: "current-branch", CommitHash: "sha1", Head: true},
|
||||||
{Name: "other-branch", CommitHash: "sha1", Head: false},
|
{Name: "other-branch", CommitHash: "sha1", Head: false},
|
||||||
},
|
},
|
||||||
currentBranchName: "current-branch",
|
currentBranchName: "current-branch",
|
||||||
hasUpdateRefConfig: true,
|
hasUpdateRefConfig: true,
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 2,
|
endIdx: 2,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 * commit1
|
sha1 * commit1
|
||||||
sha2 commit2
|
sha2 commit2
|
||||||
@ -151,14 +151,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "current-branch", CommitHash: "sha1", Head: true},
|
{Name: "current-branch", CommitHash: "sha1", Head: true},
|
||||||
{Name: "other-branch", CommitHash: "sha1", Head: false},
|
{Name: "other-branch", CommitHash: "sha1", Head: false},
|
||||||
},
|
},
|
||||||
currentBranchName: "current-branch",
|
currentBranchName: "current-branch",
|
||||||
hasUpdateRefConfig: false,
|
hasUpdateRefConfig: false,
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 2,
|
endIdx: 2,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 commit1
|
sha1 commit1
|
||||||
sha2 commit2
|
sha2 commit2
|
||||||
@ -174,12 +174,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
branches: []*models.Branch{
|
branches: []*models.Branch{
|
||||||
{Name: "some-branch", CommitHash: "sha2"},
|
{Name: "some-branch", CommitHash: "sha2"},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 3,
|
endIdx: 3,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 commit1
|
sha1 commit1
|
||||||
sha2 * some-tag commit2
|
sha2 * some-tag commit2
|
||||||
@ -195,12 +195,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 5,
|
endIdx: 5,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 ⏣─╮ commit1
|
sha1 ⏣─╮ commit1
|
||||||
sha2 ◯ │ commit2
|
sha2 ◯ │ commit2
|
||||||
@ -218,13 +218,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 5,
|
endIdx: 5,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
showYouAreHereLabel: true,
|
showYouAreHereLabel: true,
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 pick commit1
|
sha1 pick commit1
|
||||||
sha2 pick commit2
|
sha2 pick commit2
|
||||||
@ -242,13 +242,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||||
},
|
},
|
||||||
startIdx: 1,
|
startIdx: 1,
|
||||||
endIdx: 5,
|
endIdx: 5,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
showYouAreHereLabel: true,
|
showYouAreHereLabel: true,
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha2 pick commit2
|
sha2 pick commit2
|
||||||
sha3 ◯ <-- YOU ARE HERE --- commit3
|
sha3 ◯ <-- YOU ARE HERE --- commit3
|
||||||
@ -265,13 +265,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||||
},
|
},
|
||||||
startIdx: 3,
|
startIdx: 3,
|
||||||
endIdx: 5,
|
endIdx: 5,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
showYouAreHereLabel: true,
|
showYouAreHereLabel: true,
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha4 ◯ commit4
|
sha4 ◯ commit4
|
||||||
sha5 ◯ commit5
|
sha5 ◯ commit5
|
||||||
@ -286,13 +286,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 2,
|
endIdx: 2,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
showYouAreHereLabel: true,
|
showYouAreHereLabel: true,
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 pick commit1
|
sha1 pick commit1
|
||||||
sha2 pick commit2
|
sha2 pick commit2
|
||||||
@ -307,13 +307,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||||
},
|
},
|
||||||
startIdx: 4,
|
startIdx: 4,
|
||||||
endIdx: 5,
|
endIdx: 5,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
showYouAreHereLabel: true,
|
showYouAreHereLabel: true,
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha5 ◯ commit5
|
sha5 ◯ commit5
|
||||||
`),
|
`),
|
||||||
@ -327,13 +327,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}, Action: todo.Pick},
|
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}, Action: todo.Pick},
|
||||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 2,
|
endIdx: 2,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
showYouAreHereLabel: true,
|
showYouAreHereLabel: true,
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 pick commit1
|
sha1 pick commit1
|
||||||
sha2 pick commit2
|
sha2 pick commit2
|
||||||
@ -346,13 +346,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}},
|
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}},
|
||||||
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
|
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
|
||||||
},
|
},
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 3,
|
endIdx: 3,
|
||||||
showGraph: true,
|
showGraph: true,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
showYouAreHereLabel: false,
|
showYouAreHereLabel: false,
|
||||||
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 pick commit1
|
sha1 pick commit1
|
||||||
sha2 ◯ commit2
|
sha2 ◯ commit2
|
||||||
@ -365,15 +365,15 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
{Name: "commit1", Sha: "sha1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"},
|
{Name: "commit1", Sha: "sha1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"},
|
||||||
{Name: "commit2", Sha: "sha2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"},
|
{Name: "commit2", Sha: "sha2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"},
|
||||||
},
|
},
|
||||||
fullDescription: true,
|
fullDescription: true,
|
||||||
timeFormat: "2006-01-02",
|
timeFormat: "2006-01-02",
|
||||||
shortTimeFormat: "3:04PM",
|
shortTimeFormat: "3:04PM",
|
||||||
startIdx: 0,
|
startIdx: 0,
|
||||||
endIdx: 2,
|
endIdx: 2,
|
||||||
showGraph: false,
|
showGraph: false,
|
||||||
bisectInfo: git_commands.NewNullBisectInfo(),
|
bisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
cherryPickedCommitShaSet: set.New[string](),
|
cherryPickedCommitHashSet: set.New[string](),
|
||||||
now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC),
|
now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC),
|
||||||
expected: formatExpected(`
|
expected: formatExpected(`
|
||||||
sha1 2:03AM Jesse Duffield commit1
|
sha1 2:03AM Jesse Duffield commit1
|
||||||
sha2 2019-12-20 Jesse Duffield commit2
|
sha2 2019-12-20 Jesse Duffield commit2
|
||||||
@ -406,14 +406,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
s.currentBranchName,
|
s.currentBranchName,
|
||||||
s.hasUpdateRefConfig,
|
s.hasUpdateRefConfig,
|
||||||
s.fullDescription,
|
s.fullDescription,
|
||||||
s.cherryPickedCommitShaSet,
|
s.cherryPickedCommitHashSet,
|
||||||
s.diffName,
|
s.diffName,
|
||||||
s.markedBaseCommit,
|
s.markedBaseCommit,
|
||||||
s.timeFormat,
|
s.timeFormat,
|
||||||
s.shortTimeFormat,
|
s.shortTimeFormat,
|
||||||
s.now,
|
s.now,
|
||||||
s.parseEmoji,
|
s.parseEmoji,
|
||||||
s.selectedCommitSha,
|
s.selectedCommitHash,
|
||||||
s.startIdx,
|
s.startIdx,
|
||||||
s.endIdx,
|
s.endIdx,
|
||||||
s.showGraph,
|
s.showGraph,
|
||||||
|
@ -32,7 +32,7 @@ type Pipe struct {
|
|||||||
|
|
||||||
var highlightStyle = style.FgLightWhite.SetBold()
|
var highlightStyle = style.FgLightWhite.SetBold()
|
||||||
|
|
||||||
func ContainsCommitSha(pipes []*Pipe, sha string) bool {
|
func ContainsCommitHash(pipes []*Pipe, sha string) bool {
|
||||||
for _, pipe := range pipes {
|
for _, pipe := range pipes {
|
||||||
if equalHashes(pipe.fromSha, sha) {
|
if equalHashes(pipe.fromSha, sha) {
|
||||||
return true
|
return true
|
||||||
@ -49,13 +49,13 @@ func (self Pipe) right() int {
|
|||||||
return max(self.fromPos, self.toPos)
|
return max(self.fromPos, self.toPos)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenderCommitGraph(commits []*models.Commit, selectedCommitSha string, getStyle func(c *models.Commit) style.TextStyle) []string {
|
func RenderCommitGraph(commits []*models.Commit, selectedCommitHash string, getStyle func(c *models.Commit) style.TextStyle) []string {
|
||||||
pipeSets := GetPipeSets(commits, getStyle)
|
pipeSets := GetPipeSets(commits, getStyle)
|
||||||
if len(pipeSets) == 0 {
|
if len(pipeSets) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
lines := RenderAux(pipeSets, commits, selectedCommitSha)
|
lines := RenderAux(pipeSets, commits, selectedCommitHash)
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ func GetPipeSets(commits []*models.Commit, getStyle func(c *models.Commit) style
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitSha string) []string {
|
func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitHash string) []string {
|
||||||
maxProcs := runtime.GOMAXPROCS(0)
|
maxProcs := runtime.GOMAXPROCS(0)
|
||||||
|
|
||||||
// splitting up the rendering of the graph into multiple goroutines allows us to render the graph in parallel
|
// splitting up the rendering of the graph into multiple goroutines allows us to render the graph in parallel
|
||||||
@ -98,7 +98,7 @@ func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitSha s
|
|||||||
if k > 0 {
|
if k > 0 {
|
||||||
prevCommit = commits[k-1]
|
prevCommit = commits[k-1]
|
||||||
}
|
}
|
||||||
line := renderPipeSet(pipeSet, selectedCommitSha, prevCommit)
|
line := renderPipeSet(pipeSet, selectedCommitHash, prevCommit)
|
||||||
innerLines = append(innerLines, line)
|
innerLines = append(innerLines, line)
|
||||||
}
|
}
|
||||||
chunks[i] = innerLines
|
chunks[i] = innerLines
|
||||||
@ -282,7 +282,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod
|
|||||||
|
|
||||||
func renderPipeSet(
|
func renderPipeSet(
|
||||||
pipes []*Pipe,
|
pipes []*Pipe,
|
||||||
selectedCommitSha string,
|
selectedCommitHash string,
|
||||||
prevCommit *models.Commit,
|
prevCommit *models.Commit,
|
||||||
) string {
|
) string {
|
||||||
maxPos := 0
|
maxPos := 0
|
||||||
@ -329,10 +329,10 @@ func renderPipeSet(
|
|||||||
// we don't want to highlight two commits if they're contiguous. We only want
|
// we don't want to highlight two commits if they're contiguous. We only want
|
||||||
// to highlight multiple things if there's an actual visible pipe involved.
|
// to highlight multiple things if there's an actual visible pipe involved.
|
||||||
highlight := true
|
highlight := true
|
||||||
if prevCommit != nil && equalHashes(prevCommit.Sha, selectedCommitSha) {
|
if prevCommit != nil && equalHashes(prevCommit.Sha, selectedCommitHash) {
|
||||||
highlight = false
|
highlight = false
|
||||||
for _, pipe := range pipes {
|
for _, pipe := range pipes {
|
||||||
if equalHashes(pipe.fromSha, selectedCommitSha) && (pipe.kind != TERMINATES || pipe.fromPos != pipe.toPos) {
|
if equalHashes(pipe.fromSha, selectedCommitHash) && (pipe.kind != TERMINATES || pipe.fromPos != pipe.toPos) {
|
||||||
highlight = true
|
highlight = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ func renderPipeSet(
|
|||||||
// so we have our commit pos again, now it's time to build the cells.
|
// so we have our commit pos again, now it's time to build the cells.
|
||||||
// we'll handle the one that's sourced from our selected commit last so that it can override the other cells.
|
// we'll handle the one that's sourced from our selected commit last so that it can override the other cells.
|
||||||
selectedPipes, nonSelectedPipes := utils.Partition(pipes, func(pipe *Pipe) bool {
|
selectedPipes, nonSelectedPipes := utils.Partition(pipes, func(pipe *Pipe) bool {
|
||||||
return highlight && equalHashes(pipe.fromSha, selectedCommitSha)
|
return highlight && equalHashes(pipe.fromSha, selectedCommitHash)
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, pipe := range nonSelectedPipes {
|
for _, pipe := range nonSelectedPipes {
|
||||||
@ -385,7 +385,7 @@ func renderPipeSet(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func equalHashes(a, b string) bool {
|
func equalHashes(a, b string) bool {
|
||||||
// if our selectedCommitSha is an empty string we treat that as meaning there is no selected commit hash
|
// if our selectedCommitHash is an empty string we treat that as meaning there is no selected commit hash
|
||||||
if a == "" || b == "" {
|
if a == "" || b == "" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaSet *set.Set[string], diffName string, now time.Time, timeFormat string, shortTimeFormat string, parseEmoji bool) [][]string {
|
func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitHashSet *set.Set[string], diffName string, now time.Time, timeFormat string, shortTimeFormat string, parseEmoji bool) [][]string {
|
||||||
var displayFunc func(*models.Commit, reflogCommitDisplayAttributes) []string
|
var displayFunc func(*models.Commit, reflogCommitDisplayAttributes) []string
|
||||||
if fullDescription {
|
if fullDescription {
|
||||||
displayFunc = getFullDescriptionDisplayStringsForReflogCommit
|
displayFunc = getFullDescriptionDisplayStringsForReflogCommit
|
||||||
@ -22,7 +22,7 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription
|
|||||||
|
|
||||||
return lo.Map(commits, func(commit *models.Commit, _ int) []string {
|
return lo.Map(commits, func(commit *models.Commit, _ int) []string {
|
||||||
diffed := commit.Sha == diffName
|
diffed := commit.Sha == diffName
|
||||||
cherryPicked := cherryPickedCommitShaSet.Includes(commit.Sha)
|
cherryPicked := cherryPickedCommitHashSet.Includes(commit.Sha)
|
||||||
return displayFunc(commit,
|
return displayFunc(commit,
|
||||||
reflogCommitDisplayAttributes{
|
reflogCommitDisplayAttributes{
|
||||||
cherryPicked: cherryPicked,
|
cherryPicked: cherryPicked,
|
||||||
|
@ -355,7 +355,7 @@ func chineseTranslationSet() TranslationSet {
|
|||||||
// 实际视图 (actual view) 是附加视图 (extras view),未来,我打算为附加视图提供更多选项卡,但现在,上面的文本只需要提及“命令日志”这个部分
|
// 实际视图 (actual view) 是附加视图 (extras view),未来,我打算为附加视图提供更多选项卡,但现在,上面的文本只需要提及“命令日志”这个部分
|
||||||
OpenCommandLogMenu: "打开命令日志菜单",
|
OpenCommandLogMenu: "打开命令日志菜单",
|
||||||
ShowingGitDiff: "显示输出:",
|
ShowingGitDiff: "显示输出:",
|
||||||
CopyCommitShaToClipboard: "将提交的 SHA 复制到剪贴板",
|
CopyCommitHashToClipboard: "将提交的 SHA 复制到剪贴板",
|
||||||
CopyCommitMessageToClipboard: "将提交消息复制到剪贴板",
|
CopyCommitMessageToClipboard: "将提交消息复制到剪贴板",
|
||||||
CopyBranchNameToClipboard: "将分支名称复制到剪贴板",
|
CopyBranchNameToClipboard: "将分支名称复制到剪贴板",
|
||||||
CopyPathToClipboard: "将文件名复制到剪贴板",
|
CopyPathToClipboard: "将文件名复制到剪贴板",
|
||||||
|
@ -308,7 +308,7 @@ func dutchTranslationSet() TranslationSet {
|
|||||||
SwapDiff: "Keer diff richting om",
|
SwapDiff: "Keer diff richting om",
|
||||||
ViewDiffingOptions: "Open diff menu",
|
ViewDiffingOptions: "Open diff menu",
|
||||||
ShowingGitDiff: "Laat output zien voor:",
|
ShowingGitDiff: "Laat output zien voor:",
|
||||||
CopyCommitShaToClipboard: "Kopieer commit hash naar klembord",
|
CopyCommitHashToClipboard: "Kopieer commit hash naar klembord",
|
||||||
CopyCommitMessageToClipboard: "Kopieer commit bericht naar klembord",
|
CopyCommitMessageToClipboard: "Kopieer commit bericht naar klembord",
|
||||||
CopyBranchNameToClipboard: "Kopieer branch name naar klembord",
|
CopyBranchNameToClipboard: "Kopieer branch name naar klembord",
|
||||||
CopyPathToClipboard: "Kopieer de bestandsnaam naar het klembord",
|
CopyPathToClipboard: "Kopieer de bestandsnaam naar het klembord",
|
||||||
|
@ -571,8 +571,8 @@ type TranslationSet struct {
|
|||||||
OpenCommandLogMenuTooltip string
|
OpenCommandLogMenuTooltip string
|
||||||
ShowingGitDiff string
|
ShowingGitDiff string
|
||||||
CommitDiff string
|
CommitDiff string
|
||||||
CopyCommitShaToClipboard string
|
CopyCommitHashToClipboard string
|
||||||
CommitSha string
|
CommitHash string
|
||||||
CommitURL string
|
CommitURL string
|
||||||
CopyCommitMessageToClipboard string
|
CopyCommitMessageToClipboard string
|
||||||
CommitMessage string
|
CommitMessage string
|
||||||
@ -855,7 +855,7 @@ type Actions struct {
|
|||||||
CopyCommitMessageToClipboard string
|
CopyCommitMessageToClipboard string
|
||||||
CopyCommitSubjectToClipboard string
|
CopyCommitSubjectToClipboard string
|
||||||
CopyCommitDiffToClipboard string
|
CopyCommitDiffToClipboard string
|
||||||
CopyCommitSHAToClipboard string
|
CopyCommitHashToClipboard string
|
||||||
CopyCommitURLToClipboard string
|
CopyCommitURLToClipboard string
|
||||||
CopyCommitAuthorToClipboard string
|
CopyCommitAuthorToClipboard string
|
||||||
CopyCommitAttributeToClipboard string
|
CopyCommitAttributeToClipboard string
|
||||||
@ -1534,8 +1534,8 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
OpenCommandLogMenuTooltip: "View options for the command log e.g. show/hide the command log and focus the command log.",
|
OpenCommandLogMenuTooltip: "View options for the command log e.g. show/hide the command log and focus the command log.",
|
||||||
ShowingGitDiff: "Showing output for:",
|
ShowingGitDiff: "Showing output for:",
|
||||||
CommitDiff: "Commit diff",
|
CommitDiff: "Commit diff",
|
||||||
CopyCommitShaToClipboard: "Copy commit hash to clipboard",
|
CopyCommitHashToClipboard: "Copy commit hash to clipboard",
|
||||||
CommitSha: "commit hash",
|
CommitHash: "Commit hash",
|
||||||
CommitURL: "Commit URL",
|
CommitURL: "Commit URL",
|
||||||
CopyCommitMessageToClipboard: "Copy commit message to clipboard",
|
CopyCommitMessageToClipboard: "Copy commit message to clipboard",
|
||||||
CommitMessage: "Commit message",
|
CommitMessage: "Commit message",
|
||||||
@ -1772,7 +1772,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
CopyCommitMessageToClipboard: "Copy commit message to clipboard",
|
CopyCommitMessageToClipboard: "Copy commit message to clipboard",
|
||||||
CopyCommitSubjectToClipboard: "Copy commit subject to clipboard",
|
CopyCommitSubjectToClipboard: "Copy commit subject to clipboard",
|
||||||
CopyCommitDiffToClipboard: "Copy commit diff to clipboard",
|
CopyCommitDiffToClipboard: "Copy commit diff to clipboard",
|
||||||
CopyCommitSHAToClipboard: "Copy full commit hash to clipboard",
|
CopyCommitHashToClipboard: "Copy full commit hash to clipboard",
|
||||||
CopyCommitURLToClipboard: "Copy commit URL to clipboard",
|
CopyCommitURLToClipboard: "Copy commit URL to clipboard",
|
||||||
CopyCommitAuthorToClipboard: "Copy commit author to clipboard",
|
CopyCommitAuthorToClipboard: "Copy commit author to clipboard",
|
||||||
CopyCommitAttributeToClipboard: "Copy to clipboard",
|
CopyCommitAttributeToClipboard: "Copy to clipboard",
|
||||||
|
@ -367,8 +367,8 @@ func japaneseTranslationSet() TranslationSet {
|
|||||||
OpenCommandLogMenu: "コマンドログメニューを開く",
|
OpenCommandLogMenu: "コマンドログメニューを開く",
|
||||||
// LcShowingGitDiff: "Showing output for:",
|
// LcShowingGitDiff: "Showing output for:",
|
||||||
CommitDiff: "コミットの差分",
|
CommitDiff: "コミットの差分",
|
||||||
CopyCommitShaToClipboard: "コミットのSHAをクリップボードにコピー",
|
CopyCommitHashToClipboard: "コミットのSHAをクリップボードにコピー",
|
||||||
CommitSha: "コミットのSHA",
|
CommitHash: "コミットのSHA",
|
||||||
CommitURL: "コミットのURL",
|
CommitURL: "コミットのURL",
|
||||||
CopyCommitMessageToClipboard: "コミットメッセージをクリップボードにコピー",
|
CopyCommitMessageToClipboard: "コミットメッセージをクリップボードにコピー",
|
||||||
CommitMessage: "コミットメッセージ",
|
CommitMessage: "コミットメッセージ",
|
||||||
@ -496,7 +496,7 @@ func japaneseTranslationSet() TranslationSet {
|
|||||||
CreateAnnotatedTag: "注釈付きタグを作成",
|
CreateAnnotatedTag: "注釈付きタグを作成",
|
||||||
CopyCommitMessageToClipboard: "コミットメッセージをクリップボードにコピー",
|
CopyCommitMessageToClipboard: "コミットメッセージをクリップボードにコピー",
|
||||||
CopyCommitDiffToClipboard: "コミットの差分をクリップボードにコピー",
|
CopyCommitDiffToClipboard: "コミットの差分をクリップボードにコピー",
|
||||||
CopyCommitSHAToClipboard: "コミットSHAをクリップボードにコピー",
|
CopyCommitHashToClipboard: "コミットSHAをクリップボードにコピー",
|
||||||
CopyCommitURLToClipboard: "コミットのURLをクリップボードにコピー",
|
CopyCommitURLToClipboard: "コミットのURLをクリップボードにコピー",
|
||||||
CopyCommitAuthorToClipboard: "コミットの作成者名をクリップボードにコピー",
|
CopyCommitAuthorToClipboard: "コミットの作成者名をクリップボードにコピー",
|
||||||
CopyCommitAttributeToClipboard: "クリップボードにコピー",
|
CopyCommitAttributeToClipboard: "クリップボードにコピー",
|
||||||
|
@ -361,8 +361,8 @@ func koreanTranslationSet() TranslationSet {
|
|||||||
OpenCommandLogMenu: "명령어 로그 메뉴 열기",
|
OpenCommandLogMenu: "명령어 로그 메뉴 열기",
|
||||||
ShowingGitDiff: "Showing output for:",
|
ShowingGitDiff: "Showing output for:",
|
||||||
CommitDiff: "커밋의 iff",
|
CommitDiff: "커밋의 iff",
|
||||||
CopyCommitShaToClipboard: "커밋 SHA를 클립보드에 복사",
|
CopyCommitHashToClipboard: "커밋 SHA를 클립보드에 복사",
|
||||||
CommitSha: "커밋 SHA",
|
CommitHash: "커밋 SHA",
|
||||||
CommitURL: "커밋 URL",
|
CommitURL: "커밋 URL",
|
||||||
CopyCommitMessageToClipboard: "커밋 메시지를 클립보드에 복사",
|
CopyCommitMessageToClipboard: "커밋 메시지를 클립보드에 복사",
|
||||||
CommitMessage: "커밋 메시지",
|
CommitMessage: "커밋 메시지",
|
||||||
@ -486,7 +486,7 @@ func koreanTranslationSet() TranslationSet {
|
|||||||
CreateAnnotatedTag: "Create annotated tag",
|
CreateAnnotatedTag: "Create annotated tag",
|
||||||
CopyCommitMessageToClipboard: "커밋 메시지를 클립보드에 복사",
|
CopyCommitMessageToClipboard: "커밋 메시지를 클립보드에 복사",
|
||||||
CopyCommitDiffToClipboard: "커밋 diff를 클립보드에 복사",
|
CopyCommitDiffToClipboard: "커밋 diff를 클립보드에 복사",
|
||||||
CopyCommitSHAToClipboard: "커밋 SHA를 클립보드에 복사",
|
CopyCommitHashToClipboard: "커밋 SHA를 클립보드에 복사",
|
||||||
CopyCommitURLToClipboard: "커밋 URL를 클립보드에 복사",
|
CopyCommitURLToClipboard: "커밋 URL를 클립보드에 복사",
|
||||||
CopyCommitAuthorToClipboard: "커밋 작성자를 클립보드에 복사",
|
CopyCommitAuthorToClipboard: "커밋 작성자를 클립보드에 복사",
|
||||||
CopyCommitAttributeToClipboard: "클립보드에 복사",
|
CopyCommitAttributeToClipboard: "클립보드에 복사",
|
||||||
|
@ -548,8 +548,8 @@ func polishTranslationSet() TranslationSet {
|
|||||||
OpenCommandLogMenuTooltip: "Pokaż opcje dla dziennika poleceń, np. pokazywanie/ukrywanie dziennika poleceń i skupienie na dzienniku poleceń.",
|
OpenCommandLogMenuTooltip: "Pokaż opcje dla dziennika poleceń, np. pokazywanie/ukrywanie dziennika poleceń i skupienie na dzienniku poleceń.",
|
||||||
ShowingGitDiff: "Pokazuje wynik dla:",
|
ShowingGitDiff: "Pokazuje wynik dla:",
|
||||||
CommitDiff: "Różnice commita",
|
CommitDiff: "Różnice commita",
|
||||||
CopyCommitShaToClipboard: "Kopiuj SHA commita do schowka",
|
CopyCommitHashToClipboard: "Kopiuj SHA commita do schowka",
|
||||||
CommitSha: "SHA commita",
|
CommitHash: "SHA commita",
|
||||||
CommitURL: "URL commita",
|
CommitURL: "URL commita",
|
||||||
CopyCommitMessageToClipboard: "Kopiuj wiadomość commita do schowka",
|
CopyCommitMessageToClipboard: "Kopiuj wiadomość commita do schowka",
|
||||||
CommitMessage: "Wiadomość commita",
|
CommitMessage: "Wiadomość commita",
|
||||||
@ -784,7 +784,7 @@ func polishTranslationSet() TranslationSet {
|
|||||||
CopyCommitMessageToClipboard: "Kopiuj wiadomość commita do schowka",
|
CopyCommitMessageToClipboard: "Kopiuj wiadomość commita do schowka",
|
||||||
CopyCommitSubjectToClipboard: "Kopiuj temat commita do schowka",
|
CopyCommitSubjectToClipboard: "Kopiuj temat commita do schowka",
|
||||||
CopyCommitDiffToClipboard: "Kopiuj różnice commita do schowka",
|
CopyCommitDiffToClipboard: "Kopiuj różnice commita do schowka",
|
||||||
CopyCommitSHAToClipboard: "Kopiuj SHA commita do schowka",
|
CopyCommitHashToClipboard: "Kopiuj SHA commita do schowka",
|
||||||
CopyCommitURLToClipboard: "Kopiuj URL commita do schowka",
|
CopyCommitURLToClipboard: "Kopiuj URL commita do schowka",
|
||||||
CopyCommitAuthorToClipboard: "Kopiuj autora commita do schowka",
|
CopyCommitAuthorToClipboard: "Kopiuj autora commita do schowka",
|
||||||
CopyCommitAttributeToClipboard: "Kopiuj do schowka",
|
CopyCommitAttributeToClipboard: "Kopiuj do schowka",
|
||||||
|
@ -422,8 +422,8 @@ func RussianTranslationSet() TranslationSet {
|
|||||||
OpenCommandLogMenu: "Открыть меню журнала команд",
|
OpenCommandLogMenu: "Открыть меню журнала команд",
|
||||||
ShowingGitDiff: "Показывает вывод для:",
|
ShowingGitDiff: "Показывает вывод для:",
|
||||||
CommitDiff: "Разница коммита",
|
CommitDiff: "Разница коммита",
|
||||||
CopyCommitShaToClipboard: "Скопировать SHA коммита в буфер обмена",
|
CopyCommitHashToClipboard: "Скопировать SHA коммита в буфер обмена",
|
||||||
CommitSha: "SHA коммита",
|
CommitHash: "SHA коммита",
|
||||||
CommitURL: "URL коммита",
|
CommitURL: "URL коммита",
|
||||||
CopyCommitMessageToClipboard: "Скопировать сообщение коммита в буфер обмена",
|
CopyCommitMessageToClipboard: "Скопировать сообщение коммита в буфер обмена",
|
||||||
CommitMessage: "Полное сообщение коммита",
|
CommitMessage: "Полное сообщение коммита",
|
||||||
@ -579,7 +579,7 @@ func RussianTranslationSet() TranslationSet {
|
|||||||
CopyCommitMessageToClipboard: "Скопировать сообщение коммита в буфер обмена",
|
CopyCommitMessageToClipboard: "Скопировать сообщение коммита в буфер обмена",
|
||||||
CopyCommitSubjectToClipboard: "Скопировать тему коммита в буфер обмена",
|
CopyCommitSubjectToClipboard: "Скопировать тему коммита в буфер обмена",
|
||||||
CopyCommitDiffToClipboard: "Скопировать сравнения коммита в буфер обмена",
|
CopyCommitDiffToClipboard: "Скопировать сравнения коммита в буфер обмена",
|
||||||
CopyCommitSHAToClipboard: "Скопировать SHA коммита в буфер обмена",
|
CopyCommitHashToClipboard: "Скопировать SHA коммита в буфер обмена",
|
||||||
CopyCommitURLToClipboard: "Скопировать URL коммита в буфер обмена",
|
CopyCommitURLToClipboard: "Скопировать URL коммита в буфер обмена",
|
||||||
CopyCommitAuthorToClipboard: "Скопировать автора коммита в буфер обмена",
|
CopyCommitAuthorToClipboard: "Скопировать автора коммита в буфер обмена",
|
||||||
CopyCommitAttributeToClipboard: "Скопировать в буфер обмена",
|
CopyCommitAttributeToClipboard: "Скопировать в буфер обмена",
|
||||||
|
@ -454,8 +454,8 @@ func traditionalChineseTranslationSet() TranslationSet {
|
|||||||
OpenCommandLogMenu: "開啟命令記錄選單",
|
OpenCommandLogMenu: "開啟命令記錄選單",
|
||||||
ShowingGitDiff: "顯示輸出:",
|
ShowingGitDiff: "顯示輸出:",
|
||||||
CommitDiff: "提交差異",
|
CommitDiff: "提交差異",
|
||||||
CopyCommitShaToClipboard: "複製提交 SHA 到剪貼簿",
|
CopyCommitHashToClipboard: "複製提交 SHA 到剪貼簿",
|
||||||
CommitSha: "提交 SHA",
|
CommitHash: "提交 SHA",
|
||||||
CommitURL: "提交 URL",
|
CommitURL: "提交 URL",
|
||||||
CopyCommitMessageToClipboard: "複製提交訊息到剪貼簿",
|
CopyCommitMessageToClipboard: "複製提交訊息到剪貼簿",
|
||||||
CommitMessage: "提交訊息",
|
CommitMessage: "提交訊息",
|
||||||
@ -647,7 +647,7 @@ func traditionalChineseTranslationSet() TranslationSet {
|
|||||||
CreateAnnotatedTag: "建立附註標籤",
|
CreateAnnotatedTag: "建立附註標籤",
|
||||||
CopyCommitMessageToClipboard: "將提交訊息複製到剪貼簿",
|
CopyCommitMessageToClipboard: "將提交訊息複製到剪貼簿",
|
||||||
CopyCommitDiffToClipboard: "將提交差異複製到剪貼簿",
|
CopyCommitDiffToClipboard: "將提交差異複製到剪貼簿",
|
||||||
CopyCommitSHAToClipboard: "將提交 SHA 複製到剪貼簿",
|
CopyCommitHashToClipboard: "將提交 SHA 複製到剪貼簿",
|
||||||
CopyCommitURLToClipboard: "將提交 URL 複製到剪貼簿",
|
CopyCommitURLToClipboard: "將提交 URL 複製到剪貼簿",
|
||||||
CopyCommitAuthorToClipboard: "將提交作者複製到剪貼簿",
|
CopyCommitAuthorToClipboard: "將提交作者複製到剪貼簿",
|
||||||
CopyCommitAttributeToClipboard: "複製到剪貼簿",
|
CopyCommitAttributeToClipboard: "複製到剪貼簿",
|
||||||
|
Reference in New Issue
Block a user