1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-29 00:51:35 +02:00
This commit is contained in:
Jesse Duffield
2021-12-30 17:19:01 +11:00
parent 96c2887fd0
commit 9b2b0fc122
22 changed files with 453 additions and 471 deletions

View File

@ -9,7 +9,6 @@ import (
"strconv"
"strings"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
@ -37,20 +36,26 @@ type CommitLoader struct {
dotGitDir string
}
type CommitLoaderGitCommand interface {
CurrentBranchName() (string, string, error)
RebaseMode() (enums.RebaseMode, error)
GetCmd() oscommands.ICmdObjBuilder
GetDotGitDir() string
}
// making our dependencies explicit for the sake of easier testing
func NewCommitLoader(
cmn *common.Common,
gitCommand *commands.GitCommand,
osCommand *oscommands.OSCommand,
gitCommand CommitLoaderGitCommand,
) *CommitLoader {
return &CommitLoader{
Common: cmn,
cmd: gitCommand.Cmd,
cmd: gitCommand.GetCmd(),
getCurrentBranchName: gitCommand.CurrentBranchName,
getRebaseMode: gitCommand.RebaseMode,
readFile: ioutil.ReadFile,
walkFiles: filepath.Walk,
dotGitDir: gitCommand.DotGitDir,
dotGitDir: gitCommand.GetDotGitDir(),
}
}