mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Use fields rather than methods on worktrees
I would prefer to use methods to keep things immutable but I'd rather be consistent with the other models and update them all at once
This commit is contained in:
@ -87,7 +87,7 @@ func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error) {
|
||||
}))
|
||||
|
||||
for index, worktree := range worktrees {
|
||||
worktree.NameField = names[index]
|
||||
worktree.Name = names[index]
|
||||
}
|
||||
|
||||
// move current worktree to the top
|
||||
|
@ -21,11 +21,11 @@ type Worktree struct {
|
||||
Branch string
|
||||
// based on the path, but uniquified. Not the same name that git uses in the worktrees/ folder (no good reason for this,
|
||||
// I just prefer my naming convention better)
|
||||
NameField string
|
||||
Name string
|
||||
}
|
||||
|
||||
func (w *Worktree) RefName() string {
|
||||
return w.Name()
|
||||
return w.Name
|
||||
}
|
||||
|
||||
func (w *Worktree) ID() string {
|
||||
@ -35,19 +35,3 @@ func (w *Worktree) ID() string {
|
||||
func (w *Worktree) Description() string {
|
||||
return w.RefName()
|
||||
}
|
||||
|
||||
func (w *Worktree) Name() string {
|
||||
return w.NameField
|
||||
}
|
||||
|
||||
func (w *Worktree) Main() bool {
|
||||
return w.IsMain
|
||||
}
|
||||
|
||||
func (w *Worktree) Current() bool {
|
||||
return w.IsCurrent
|
||||
}
|
||||
|
||||
func (w *Worktree) PathMissing() bool {
|
||||
return w.IsPathMissing
|
||||
}
|
||||
|
Reference in New Issue
Block a user