mirror of https://github.com/Marcusk19/dotctl
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
538 B
Go
26 lines
538 B
Go
package test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/Marcusk19/dotctl/cmd"
|
|
gogit "github.com/go-git/go-git/v5"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// initLocalGitRepo creates a temp directory and initializes it as a git repo.
|
|
func initLocalGitRepo(t *testing.T) string {
|
|
t.Helper()
|
|
dir := t.TempDir()
|
|
_, err := gogit.PlainInit(dir, false)
|
|
require.NoError(t, err)
|
|
return dir
|
|
}
|
|
|
|
// resetGlobalState resets the global cmd flags to defaults.
|
|
func resetGlobalState() {
|
|
cmd.DryRun = false
|
|
cmd.Overwrite = false
|
|
cmd.NoBackup = false
|
|
}
|