summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-28 18:53:00 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-30 18:35:24 +1000
commit06be88aef7fc011a1ac1c04ce094b4aafd7bad69 (patch)
tree540cee503566c4d4c24e250b792c8fedf04d6e88 /pkg/commands
parent4c5b1574f147fe2005bcd30bbb5dc106c4838b92 (diff)
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
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_commands/worktree_loader.go2
-rw-r--r--pkg/commands/models/worktree.go20
2 files changed, 3 insertions, 19 deletions
diff --git a/pkg/commands/git_commands/worktree_loader.go b/pkg/commands/git_commands/worktree_loader.go
index 06a22d2b5..d81b23f4b 100644
--- a/pkg/commands/git_commands/worktree_loader.go
+++ b/pkg/commands/git_commands/worktree_loader.go
@@ -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
diff --git a/pkg/commands/models/worktree.go b/pkg/commands/models/worktree.go
index 662d137dc..58d4bf790 100644
--- a/pkg/commands/models/worktree.go
+++ b/pkg/commands/models/worktree.go
@@ -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
-}