mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Add ShortRefName to Ref interface
This commit is contained in:
@ -53,6 +53,10 @@ func (b *Branch) RefName() string {
|
|||||||
return b.Name
|
return b.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Branch) ShortRefName() string {
|
||||||
|
return b.RefName()
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Branch) ParentRefName() string {
|
func (b *Branch) ParentRefName() string {
|
||||||
return b.RefName() + "^"
|
return b.RefName() + "^"
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,10 @@ func (c *Commit) RefName() string {
|
|||||||
return c.Hash
|
return c.Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Commit) ShortRefName() string {
|
||||||
|
return c.Hash[:7]
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Commit) ParentRefName() string {
|
func (c *Commit) ParentRefName() string {
|
||||||
if c.IsFirstCommit() {
|
if c.IsFirstCommit() {
|
||||||
return EmptyTreeCommitHash
|
return EmptyTreeCommitHash
|
||||||
|
@ -18,6 +18,10 @@ func (r *RemoteBranch) RefName() string {
|
|||||||
return r.FullName()
|
return r.FullName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *RemoteBranch) ShortRefName() string {
|
||||||
|
return r.RefName()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *RemoteBranch) ParentRefName() string {
|
func (r *RemoteBranch) ParentRefName() string {
|
||||||
return r.RefName() + "^"
|
return r.RefName() + "^"
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@ func (s *StashEntry) RefName() string {
|
|||||||
return fmt.Sprintf("stash@{%d}", s.Index)
|
return fmt.Sprintf("stash@{%d}", s.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StashEntry) ShortRefName() string {
|
||||||
|
return s.RefName()
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StashEntry) ParentRefName() string {
|
func (s *StashEntry) ParentRefName() string {
|
||||||
return s.RefName() + "^"
|
return s.RefName() + "^"
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ func (t *Tag) RefName() string {
|
|||||||
return t.Name
|
return t.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Tag) ShortRefName() string {
|
||||||
|
return t.RefName()
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Tag) ParentRefName() string {
|
func (t *Tag) ParentRefName() string {
|
||||||
return t.RefName() + "^"
|
return t.RefName() + "^"
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package types
|
|||||||
type Ref interface {
|
type Ref interface {
|
||||||
FullRefName() string
|
FullRefName() string
|
||||||
RefName() string
|
RefName() string
|
||||||
|
ShortRefName() string
|
||||||
ParentRefName() string
|
ParentRefName() string
|
||||||
Description() string
|
Description() string
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user