diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-19 14:48:39 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-19 14:48:39 +1000 |
commit | cd9eada0c6b3fdb68519467807bf2c8e6eb521bd (patch) | |
tree | f41c0db2dcc800059e8cb31d45f26b9e14a20318 /pkg/test/test.go | |
parent | bd91b9e1e9fdc8cd199d105118ce13f94e6b5fe5 (diff) |
add test for variety of potential git diff situations
Diffstat (limited to 'pkg/test/test.go')
-rw-r--r-- | pkg/test/test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/test/test.go b/pkg/test/test.go new file mode 100644 index 000000000..7bdbd4c10 --- /dev/null +++ b/pkg/test/test.go @@ -0,0 +1,25 @@ +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)) + } + if err := os.Chdir(testPath + "repo"); err != nil { + return err + } + return nil +} |