diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-17 19:59:51 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-30 18:35:23 +1000 |
commit | cdfad864ae337b9743a6f6ccc15fe1c088340f94 (patch) | |
tree | 015e27ec1f33071215dc7fce3ead3755500f0044 /pkg/gui | |
parent | fb4453c18a7b53bb3b03006759221b50c856abb0 (diff) |
Remove worktree version guards
Our min required git version is 2.20 so there's no need to add guards
for worktrees because they were added in 2.5
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/controllers.go | 22 | ||||
-rw-r--r-- | pkg/gui/controllers/helpers/refresh_helper.go | 10 | ||||
-rw-r--r-- | pkg/gui/gui.go | 15 |
3 files changed, 15 insertions, 32 deletions
diff --git a/pkg/gui/controllers.go b/pkg/gui/controllers.go index 9536fbd8f..9d76349c7 100644 --- a/pkg/gui/controllers.go +++ b/pkg/gui/controllers.go @@ -242,18 +242,16 @@ func (gui *Gui) resetHelpersAndControllers() { controllers.AttachControllers(context, controllers.NewBasicCommitsController(common, context)) } - if gui.c.Git().Version.SupportsWorktrees() { - for _, context := range []controllers.CanViewWorktreeOptions{ - gui.State.Contexts.LocalCommits, - gui.State.Contexts.ReflogCommits, - gui.State.Contexts.SubCommits, - gui.State.Contexts.Stash, - gui.State.Contexts.Branches, - gui.State.Contexts.RemoteBranches, - gui.State.Contexts.Tags, - } { - controllers.AttachControllers(context, controllers.NewWorktreeOptionsController(common, context)) - } + for _, context := range []controllers.CanViewWorktreeOptions{ + gui.State.Contexts.LocalCommits, + gui.State.Contexts.ReflogCommits, + gui.State.Contexts.SubCommits, + gui.State.Contexts.Stash, + gui.State.Contexts.Branches, + gui.State.Contexts.RemoteBranches, + gui.State.Contexts.Tags, + } { + controllers.AttachControllers(context, controllers.NewWorktreeOptionsController(common, context)) } controllers.AttachControllers(gui.State.Contexts.ReflogCommits, diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 78194e876..0dc6924f9 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -598,11 +598,6 @@ func (self *RefreshHelper) refreshRemotes() error { } func (self *RefreshHelper) refreshWorktrees() error { - if !self.c.Git().Version.SupportsWorktrees() { - self.c.Model().Worktrees = []*models.Worktree{} - return nil - } - worktrees, err := self.c.Git().Loaders.Worktrees.GetWorktrees() if err != nil { self.c.Log.Error(err) @@ -634,10 +629,7 @@ func (self *RefreshHelper) refreshStatus() { } workingTreeState := self.c.Git().Status.WorkingTreeState() - var linkedWorktreeName string - if self.c.Git().Version.SupportsWorktrees() { - linkedWorktreeName = self.worktreeHelper.GetLinkedWorktreeName() - } + linkedWorktreeName := self.worktreeHelper.GetLinkedWorktreeName() repoName := git_commands.GetCurrentRepoName() diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 838d70792..03cf74217 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -596,6 +596,10 @@ func (gui *Gui) viewTabMap() map[string][]context.TabView { Tab: gui.c.Tr.FilesTitle, ViewName: "files", }, + context.TabView{ + Tab: gui.c.Tr.WorktreesTitle, + ViewName: "worktrees", + }, { Tab: gui.c.Tr.SubmodulesTitle, ViewName: "submodules", @@ -603,17 +607,6 @@ func (gui *Gui) viewTabMap() map[string][]context.TabView { }, } - if gui.c.Git().Version.SupportsWorktrees() { - // insert between files and submodules tabs - result["files"] = append(result["files"][0:1], - context.TabView{ - Tab: gui.c.Tr.WorktreesTitle, - ViewName: "worktrees", - }, - result["files"][1], - ) - } - return result } |