mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Only show worktree in status panel if not the main worktree and worktrees are supported
This commit is contained in:
@ -45,6 +45,22 @@ func (self *WorktreeHelper) GetMainWorktreeName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// If we're on the main worktree, we return an empty string
|
||||
func (self *WorktreeHelper) GetLinkedWorktreeName() string {
|
||||
worktrees := self.c.Model().Worktrees
|
||||
if len(worktrees) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
// worktrees always have the current worktree on top
|
||||
currentWorktree := worktrees[0]
|
||||
if currentWorktree.Main() {
|
||||
return ""
|
||||
}
|
||||
|
||||
return currentWorktree.Name()
|
||||
}
|
||||
|
||||
func (self *WorktreeHelper) IsCurrentWorktree(w *models.Worktree) bool {
|
||||
pwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user