1
0
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:
Jesse Duffield
2023-07-17 14:10:07 +10:00
parent 3cd2d6fa5c
commit a06a5cadee
3 changed files with 26 additions and 5 deletions

View File

@ -10,7 +10,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
func FormatStatus(currentBranch *models.Branch, mainWorktreeName string, workingTreeState enums.RebaseMode, tr *i18n.TranslationSet) string {
func FormatStatus(currentBranch *models.Branch, linkedWorktreeName string, workingTreeState enums.RebaseMode, tr *i18n.TranslationSet) string {
status := ""
if currentBranch.IsRealBranch() {
@ -23,8 +23,9 @@ func FormatStatus(currentBranch *models.Branch, mainWorktreeName string, working
name := GetBranchTextStyle(currentBranch.Name).Sprint(currentBranch.Name)
repoName := utils.GetCurrentRepoName()
if repoName != mainWorktreeName {
repoName = fmt.Sprintf("%s(%s)", mainWorktreeName, style.FgCyan.Sprint(repoName))
// If the user is in a linked worktree (i.e. not the main worktree) we'll display that
if linkedWorktreeName != "" {
repoName = fmt.Sprintf("%s(%s)", repoName, style.FgCyan.Sprint(linkedWorktreeName))
}
status += fmt.Sprintf("%s → %s ", repoName, name)