mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Remove go-git repo from GitCommon
It is no longer used now.
This commit is contained in:
parent
6f9d234116
commit
a930f74397
|
|
@ -2,11 +2,9 @@ package commands
|
|||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
|
||||
gogit "github.com/jesseduffield/go-git/v5"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_config"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
|
|
@ -72,24 +70,12 @@ func NewGitCommand(
|
|||
return nil, utils.WrapError(err)
|
||||
}
|
||||
|
||||
repository, err := gogit.PlainOpenWithOptions(
|
||||
repoPaths.WorktreeGitDirPath(),
|
||||
&gogit.PlainOpenOptions{DetectDotGit: false, EnableDotGitCommonDir: true},
|
||||
)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), `unquoted '\' must be followed by new line`) {
|
||||
return nil, errors.New(cmn.Tr.GitconfigParseErr)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return NewGitCommandAux(
|
||||
cmn,
|
||||
version,
|
||||
osCommand,
|
||||
gitConfig,
|
||||
repoPaths,
|
||||
repository,
|
||||
pagerConfig,
|
||||
), nil
|
||||
}
|
||||
|
|
@ -100,7 +86,6 @@ func NewGitCommandAux(
|
|||
osCommand *oscommands.OSCommand,
|
||||
gitConfig git_config.IGitConfig,
|
||||
repoPaths *git_commands.RepoPaths,
|
||||
repo *gogit.Repository,
|
||||
pagerConfig *config.PagerConfig,
|
||||
) *GitCommand {
|
||||
cmd := NewGitCmdObjBuilder(cmn.Log, osCommand.Cmd)
|
||||
|
|
@ -112,7 +97,7 @@ func NewGitCommandAux(
|
|||
// common ones are: cmn, osCommand, dotGitDir, configCommands
|
||||
configCommands := git_commands.NewConfigCommands(cmn, gitConfig)
|
||||
|
||||
gitCommon := git_commands.NewGitCommon(cmn, version, cmd, osCommand, repoPaths, repo, configCommands, pagerConfig)
|
||||
gitCommon := git_commands.NewGitCommon(cmn, version, cmd, osCommand, repoPaths, configCommands, pagerConfig)
|
||||
|
||||
fileLoader := git_commands.NewFileLoader(gitCommon, cmd, configCommands)
|
||||
statusCommands := git_commands.NewStatusCommands(gitCommon)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package git_commands
|
||||
|
||||
import (
|
||||
gogit "github.com/jesseduffield/go-git/v5"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
|
|
@ -13,7 +12,6 @@ type GitCommon struct {
|
|||
cmd oscommands.ICmdObjBuilder
|
||||
os *oscommands.OSCommand
|
||||
repoPaths *RepoPaths
|
||||
repo *gogit.Repository
|
||||
config *ConfigCommands
|
||||
pagerConfig *config.PagerConfig
|
||||
}
|
||||
|
|
@ -24,7 +22,6 @@ func NewGitCommon(
|
|||
cmd oscommands.ICmdObjBuilder,
|
||||
osCommand *oscommands.OSCommand,
|
||||
repoPaths *RepoPaths,
|
||||
repo *gogit.Repository,
|
||||
config *ConfigCommands,
|
||||
pagerConfig *config.PagerConfig,
|
||||
) *GitCommon {
|
||||
|
|
@ -34,7 +31,6 @@ func NewGitCommon(
|
|||
cmd: cmd,
|
||||
os: osCommand,
|
||||
repoPaths: repoPaths,
|
||||
repo: repo,
|
||||
config: config,
|
||||
pagerConfig: pagerConfig,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
gogit "github.com/jesseduffield/go-git/v5"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_config"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
|
|
@ -75,7 +74,6 @@ func buildGitCommon(deps commonDeps) *GitCommon {
|
|||
gitConfig = git_config.NewFakeGitConfig(nil)
|
||||
}
|
||||
|
||||
gitCommon.repo = buildRepo()
|
||||
gitCommon.config = NewConfigCommands(gitCommon.Common, gitConfig)
|
||||
|
||||
getenv := deps.getenv
|
||||
|
|
@ -99,12 +97,6 @@ func buildGitCommon(deps commonDeps) *GitCommon {
|
|||
return gitCommon
|
||||
}
|
||||
|
||||
func buildRepo() *gogit.Repository {
|
||||
// TODO: think of a way to actually mock this out
|
||||
var repo *gogit.Repository
|
||||
return repo
|
||||
}
|
||||
|
||||
func buildFileLoader(gitCommon *GitCommon) *FileLoader {
|
||||
return NewFileLoader(gitCommon, gitCommon.cmd, gitCommon.config)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue