summaryrefslogtreecommitdiffstats
path: root/pkg/test/test.go
blob: b5da229032002b06af497dbd5f4344f17426c7d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package test

import (
	"errors"
	"os"
	"os/exec"

	"github.com/jesseduffield/lazygit/pkg/utils"
)

// GenerateRepo generates a repo from test/repos and changes the directory to be
// inside the newly made repo
func GenerateRepo(filename string) error {
	testPath := utils.GetProjectRoot() + "/test/repos/"
	if err := os.Chdir(testPath); err != nil {
		return err
	}
	if output, err := exec.Command("bash", filename).CombinedOutput(); err != nil {
		return errors.New(string(output))
	}

	return os.Chdir(testPath + "repo")
}