2020-09-29 18:46:45 +10:00
|
|
|
package models
|
2018-09-17 21:02:30 +10:00
|
|
|
|
2020-03-29 14:34:17 +11:00
|
|
|
import "fmt"
|
|
|
|
|
2018-09-17 21:02:30 +10:00
|
|
|
// StashEntry : A git stash entry
|
|
|
|
type StashEntry struct {
|
2023-12-20 20:51:39 +01:00
|
|
|
Index int
|
|
|
|
Recency string
|
|
|
|
Name string
|
2018-09-17 21:02:30 +10:00
|
|
|
}
|
2020-03-29 14:34:17 +11:00
|
|
|
|
2022-05-12 19:16:58 +09:00
|
|
|
func (s *StashEntry) FullRefName() string {
|
|
|
|
return s.RefName()
|
|
|
|
}
|
|
|
|
|
2020-03-29 14:34:17 +11:00
|
|
|
func (s *StashEntry) RefName() string {
|
|
|
|
return fmt.Sprintf("stash@{%d}", s.Index)
|
|
|
|
}
|
2020-08-22 09:01:14 +10:00
|
|
|
|
2022-03-26 22:18:08 +09:00
|
|
|
func (s *StashEntry) ParentRefName() string {
|
|
|
|
return s.RefName() + "^"
|
|
|
|
}
|
|
|
|
|
2020-08-22 09:01:14 +10:00
|
|
|
func (s *StashEntry) ID() string {
|
|
|
|
return s.RefName()
|
|
|
|
}
|
2020-08-22 10:14:53 +10:00
|
|
|
|
|
|
|
func (s *StashEntry) Description() string {
|
|
|
|
return s.RefName() + ": " + s.Name
|
|
|
|
}
|