summaryrefslogtreecommitdiffstats
path: root/pkg/commands/dummies.go
blob: c17179c8e1a50fa6e92eadf59993100fe6abe2c3 (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
package commands

import (
	"io"
	"io/ioutil"

	"github.com/jesseduffield/lazygit/pkg/commands/git_config"
	"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 &GitCommand{
		Common:       utils.NewDummyCommon(),
		OSCommand:    osCommand,
		GitConfig:    git_config.NewFakeGitConfig(map[string]string{}),
		GetCmdWriter: func() io.Writer { return ioutil.Discard },
	}
}