summaryrefslogtreecommitdiffstats
path: root/pkg/commands/dummies.go
blob: 1f4b4c1efe18eed99db46653a953133da1642f62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package commands

import (
	"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
	"github.com/jesseduffield/lazygit/pkg/utils"
)

// NewDummyGitCommand creates a new dummy GitCommand for testing
func NewDummyGitCommand() *GitCommand {
	return NewDummyGitCommandWithOSCommand(oscommands.NewDummyOSCommand())
}

// NewDummyGitCommandWithOSCommand creates a new dummy GitCommand for testing
func NewDummyGitCommandWithOSCommand(osCommand *oscommands.OSCommand) *GitCommand {
	return NewGitCommandAux(
		utils.NewDummyCommon(),
		osCommand,
		utils.NewDummyGitConfig(),
		".git",
		nil,
	)
}

func NewDummyGitCommandWithRunner(runner oscommands.ICmdObjRunner) *GitCommand {
	builder := oscommands.NewDummyCmdObjBuilder(runner)
	gitCommand := NewDummyGitCommand()
	gitCommand.Cmd = builder
	gitCommand.OSCommand.Cmd = builder

	return gitCommand
}