1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-31 23:19:40 +02:00

fix: fix ambiguous refname

This commit is contained in:
Ryooooooga 2022-05-12 19:16:58 +09:00
parent 5529088e43
commit 61970a4439
No known key found for this signature in database
GPG Key ID: 07CF200DFCC20C25
10 changed files with 25 additions and 4 deletions

View File

@ -18,6 +18,10 @@ type Branch struct {
UpstreamBranch string
}
func (b *Branch) FullRefName() string {
return "refs/heads/" + b.Name
}
func (b *Branch) RefName() string {
return b.Name
}

View File

@ -29,6 +29,10 @@ func (c *Commit) ShortSha() string {
return utils.ShortSha(c.Sha)
}
func (c *Commit) FullRefName() string {
return c.Sha
}
func (c *Commit) RefName() string {
return c.Sha
}

View File

@ -10,6 +10,10 @@ func (r *RemoteBranch) FullName() string {
return r.RemoteName + "/" + r.Name
}
func (r *RemoteBranch) FullRefName() string {
return "refs/remotes/" + r.FullName()
}
func (r *RemoteBranch) RefName() string {
return r.FullName()
}

View File

@ -8,6 +8,10 @@ type StashEntry struct {
Name string
}
func (s *StashEntry) FullRefName() string {
return s.RefName()
}
func (s *StashEntry) RefName() string {
return fmt.Sprintf("stash@{%d}", s.Index)
}

View File

@ -5,6 +5,10 @@ type Tag struct {
Name string
}
func (t *Tag) FullRefName() string {
return "refs/tags/" + t.RefName()
}
func (t *Tag) RefName() string {
return t.Name
}

View File

@ -6,7 +6,7 @@ func (gui *Gui) branchesRenderToMain() error {
if branch == nil {
task = NewRenderStringTask(gui.c.Tr.NoBranchesThisRepo)
} else {
cmdObj := gui.git.Branch.GetGraphCmdObj(branch.Name)
cmdObj := gui.git.Branch.GetGraphCmdObj(branch.FullRefName())
task = NewRunPtyTask(cmdObj.GetCmd())
}

View File

@ -62,7 +62,7 @@ func (self *SwitchToSubCommitsController) viewCommits() error {
Limit: true,
FilterPath: self.modes.Filtering.GetPath(),
IncludeRebaseCommits: false,
RefName: ref.RefName(),
RefName: ref.FullRefName(),
},
)
if err != nil {

View File

@ -6,7 +6,7 @@ func (gui *Gui) remoteBranchesRenderToMain() error {
if remoteBranch == nil {
task = NewRenderStringTask("No branches for this remote")
} else {
cmdObj := gui.git.Branch.GetGraphCmdObj(remoteBranch.FullName())
cmdObj := gui.git.Branch.GetGraphCmdObj(remoteBranch.FullRefName())
task = NewRunCommandTask(cmdObj.GetCmd())
}

View File

@ -6,7 +6,7 @@ func (self *Gui) tagsRenderToMain() error {
if tag == nil {
task = NewRenderStringTask("No tags")
} else {
cmdObj := self.git.Branch.GetGraphCmdObj(tag.Name)
cmdObj := self.git.Branch.GetGraphCmdObj(tag.FullRefName())
task = NewRunCommandTask(cmdObj.GetCmd())
}

View File

@ -1,6 +1,7 @@
package types
type Ref interface {
FullRefName() string
RefName() string
ParentRefName() string
Description() string