diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-07 15:07:35 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-09 14:09:53 +1100 |
commit | 3f44eac95b3835bdd00b84aafca9ae0bc80ad7dd (patch) | |
tree | e5e7279113d45afb915a9acae79055b79e0d0f9a /pkg/commands | |
parent | 946a35b59de44094759fa177c0218837364c9dd7 (diff) |
remove repo field
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/config.go | 13 | ||||
-rw-r--r-- | pkg/commands/git.go | 4 |
2 files changed, 13 insertions, 4 deletions
diff --git a/pkg/commands/config.go b/pkg/commands/config.go index db918ec86..52eb82ac3 100644 --- a/pkg/commands/config.go +++ b/pkg/commands/config.go @@ -5,6 +5,8 @@ import ( "strconv" "strings" + gogit "github.com/jesseduffield/go-git/v5" + "github.com/jesseduffield/go-git/v5/config" "github.com/jesseduffield/lazygit/pkg/commands/git_config" "github.com/jesseduffield/lazygit/pkg/common" "github.com/jesseduffield/lazygit/pkg/utils" @@ -14,6 +16,7 @@ type ConfigCommands struct { *common.Common gitConfig git_config.IGitConfig + repo *gogit.Repository } func NewConfigCommands( @@ -80,3 +83,13 @@ func (self *ConfigCommands) GetShowUntrackedFiles() string { func (self *ConfigCommands) GetPushToCurrent() bool { return self.gitConfig.Get("push.default") == "current" } + +// returns the repo's branches as specified in the git config +func (self *ConfigCommands) Branches() (map[string]*config.Branch, error) { + conf, err := self.repo.Config() + if err != nil { + return nil, err + } + + return conf.Branches, nil +} diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 2f38757f7..d7915328c 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -22,8 +22,6 @@ import ( type GitCommand struct { *common.Common - Repo *gogit.Repository - Loaders Loaders Cmd oscommands.ICmdObjBuilder @@ -123,8 +121,6 @@ func NewGitCommandAux( return &GitCommand{ Common: cmn, - Repo: repo, - Cmd: cmd, Submodule: submoduleCommands, |