1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Better logic for knowing which repo we're in

This commit is contained in:
Jesse Duffield
2023-07-17 14:38:08 +10:00
parent a06a5cadee
commit b73efb2c22
8 changed files with 54 additions and 24 deletions

View File

@@ -637,7 +637,9 @@ func (self *RefreshHelper) refreshStatus() {
linkedWorktreeName = self.worktreeHelper.GetLinkedWorktreeName()
}
status := presentation.FormatStatus(currentBranch, linkedWorktreeName, workingTreeState, self.c.Tr)
repoName := git_commands.GetCurrentRepoName()
status := presentation.FormatStatus(repoName, currentBranch, linkedWorktreeName, workingTreeState, self.c.Tr)
self.c.SetViewContent(self.c.Views().Status, status)
}

View File

@@ -4,11 +4,11 @@ import (
"fmt"
"regexp"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
)
type IWorkingTreeHelper interface {
@@ -203,7 +203,7 @@ func (self *WorkingTreeHelper) prepareFilesForCommit() error {
}
func (self *WorkingTreeHelper) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
cfg, ok := self.c.UserConfig.Git.CommitPrefixes[utils.GetCurrentRepoName()]
cfg, ok := self.c.UserConfig.Git.CommitPrefixes[git_commands.GetCurrentRepoName()]
if !ok {
return nil
}

View File

@@ -6,12 +6,12 @@ import (
"strings"
"github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
"github.com/jesseduffield/lazygit/pkg/constants"
"github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
)
type StatusController struct {
@@ -108,7 +108,8 @@ func (self *StatusController) onClick() error {
cx, _ := self.c.Views().Status.Cursor()
upstreamStatus := presentation.BranchStatus(currentBranch, self.c.Tr)
repoName := utils.GetCurrentRepoName()
// TODO: support worktrees here
repoName := git_commands.GetCurrentRepoName()
workingTreeState := self.c.Git().Status.WorkingTreeState()
switch workingTreeState {
case enums.REBASE_MODE_REBASING, enums.REBASE_MODE_MERGING: