mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-26 05:37:18 +02:00
707fa37160
When pulling/pushing/fast-forwarding a branch, show this state in the branches list for that branch for as long as the operation takes, to make it easier to see when it's done (without having to stare at the status bar in the lower left). This will hopefully help with making these operations feel more predictable, now that we no longer show a loader panel for them.
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package presentation
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
|
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
|
|
"github.com/jesseduffield/lazygit/pkg/gui/presentation/icons"
|
|
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
|
"github.com/jesseduffield/lazygit/pkg/i18n"
|
|
)
|
|
|
|
func FormatStatus(repoName string, currentBranch *models.Branch, itemOperation types.ItemOperation, linkedWorktreeName string, workingTreeState enums.RebaseMode, tr *i18n.TranslationSet) string {
|
|
status := ""
|
|
|
|
if currentBranch.IsRealBranch() {
|
|
status += ColoredBranchStatus(currentBranch, itemOperation, tr) + " "
|
|
}
|
|
|
|
if workingTreeState != enums.REBASE_MODE_NONE {
|
|
status += style.FgYellow.Sprintf("(%s) ", FormatWorkingTreeStateLower(tr, workingTreeState))
|
|
}
|
|
|
|
name := GetBranchTextStyle(currentBranch.Name).Sprint(currentBranch.Name)
|
|
// If the user is in a linked worktree (i.e. not the main worktree) we'll display that
|
|
if linkedWorktreeName != "" {
|
|
icon := ""
|
|
if icons.IsIconEnabled() {
|
|
icon = icons.LINKED_WORKTREE_ICON + " "
|
|
}
|
|
repoName = fmt.Sprintf("%s(%s%s)", repoName, icon, style.FgCyan.Sprint(linkedWorktreeName))
|
|
}
|
|
status += fmt.Sprintf("%s → %s ", repoName, name)
|
|
|
|
return status
|
|
}
|