6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-10 11:24:17 +00:00

Refactor Clone method to use go-git

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-27 12:54:49 +02:00
parent 616b476ce1
commit b94e655d4a
5 changed files with 99 additions and 19 deletions

View File

@@ -1,6 +1,8 @@
package new
import (
"io/ioutil"
"os"
"testing"
"time"
@@ -19,20 +21,20 @@ func checkFatal(t *testing.T, err error) {
}
}
//func newTempDir(t *testing.T) string {
// dir, err := ioutil.TempDir("", "git-get-repo-")
// checkFatal(t, errors.Wrap(err, "Failed creating test repo directory"))
//
// // Automatically remove repo when test is over
// t.Cleanup(func() {
// err := os.RemoveAll(dir)
// if err != nil {
// t.Errorf("failed cleaning up repo")
// }
// })
//
// return dir
//}
func newTempDir(t *testing.T) string {
dir, err := ioutil.TempDir("", "git-get-repo-")
checkFatal(t, errors.Wrap(err, "Failed creating test repo directory"))
// Automatically remove repo when test is over
t.Cleanup(func() {
err := os.RemoveAll(dir)
if err != nil {
t.Errorf("failed cleaning up repo")
}
})
return dir
}
func newTestRepo(t *testing.T) *git.Repository {
fs := memfs.New()