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:
parent
b07ce19b9a
commit
ac335907ae
@ -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() + "^"
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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() + "^"
|
||||
}
|
||||
|
@ -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() + "^"
|
||||
}
|
||||
|
@ -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() + "^"
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package types
|
||||
type Ref interface {
|
||||
FullRefName() string
|
||||
RefName() string
|
||||
ShortRefName() string
|
||||
ParentRefName() string
|
||||
Description() string
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user