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

Add ShortRefName to Ref interface

This commit is contained in:
Stefan Haller 2024-08-28 15:33:12 +02:00
parent b07ce19b9a
commit ac335907ae
6 changed files with 21 additions and 0 deletions

View File

@ -53,6 +53,10 @@ func (b *Branch) RefName() string {
return b.Name
}
func (b *Branch) ShortRefName() string {
return b.RefName()
}
func (b *Branch) ParentRefName() string {
return b.RefName() + "^"
}

View File

@ -70,6 +70,10 @@ func (c *Commit) RefName() string {
return c.Hash
}
func (c *Commit) ShortRefName() string {
return c.Hash[:7]
}
func (c *Commit) ParentRefName() string {
if c.IsFirstCommit() {
return EmptyTreeCommitHash

View File

@ -18,6 +18,10 @@ func (r *RemoteBranch) RefName() string {
return r.FullName()
}
func (r *RemoteBranch) ShortRefName() string {
return r.RefName()
}
func (r *RemoteBranch) ParentRefName() string {
return r.RefName() + "^"
}

View File

@ -17,6 +17,10 @@ func (s *StashEntry) RefName() string {
return fmt.Sprintf("stash@{%d}", s.Index)
}
func (s *StashEntry) ShortRefName() string {
return s.RefName()
}
func (s *StashEntry) ParentRefName() string {
return s.RefName() + "^"
}

View File

@ -16,6 +16,10 @@ func (t *Tag) RefName() string {
return t.Name
}
func (t *Tag) ShortRefName() string {
return t.RefName()
}
func (t *Tag) ParentRefName() string {
return t.RefName() + "^"
}

View File

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