diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-17 13:56:50 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-30 18:35:22 +1000 |
commit | 3cd2d6fa5ce0a6e81e887d7f24988e76b2c987ba (patch) | |
tree | 044158b04607c95a10819d2f2370fd701ce0e580 /pkg/commands | |
parent | ec839e9e9671e365b75cdc270d6f3602981fb9bb (diff) |
Hide worktree functionality on old git versions
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/version.go | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 4c2215820..c2c53948a 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -38,6 +38,7 @@ type GitCommand struct { WorkingTree *git_commands.WorkingTreeCommands Bisect *git_commands.BisectCommands Worktree *git_commands.WorktreeCommands + Version *git_commands.GitVersion Loaders Loaders } @@ -159,6 +160,7 @@ func NewGitCommandAux( Bisect: bisectCommands, WorkingTree: workingTreeCommands, Worktree: worktreeCommands, + Version: version, Loaders: Loaders{ BranchLoader: branchLoader, CommitFileLoader: commitFileLoader, diff --git a/pkg/commands/git_commands/version.go b/pkg/commands/git_commands/version.go index a089d7e06..7499404c0 100644 --- a/pkg/commands/git_commands/version.go +++ b/pkg/commands/git_commands/version.go @@ -69,3 +69,7 @@ func (v *GitVersion) IsOlderThan(major, minor, patch int) bool { func (v *GitVersion) IsOlderThanVersion(version *GitVersion) bool { return v.IsOlderThan(version.Major, version.Minor, version.Patch) } + +func (v *GitVersion) SupportsWorktrees() bool { + return !v.IsOlderThan(2, 5, 0) +} |