summaryrefslogtreecommitdiff
path: root/git_test.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2015-04-24 16:47:42 +0200
committerCarlos Martín Nieto <[email protected]>2015-04-24 16:47:42 +0200
commit9538c7f750dafaf3752e04b1c1747d7984ca31d0 (patch)
tree3e37d99c8266d130ea54b2080e20199e8073e99e /git_test.go
parente021457f27654ea0f1ec41963c6da62c168be853 (diff)
parente300945a3d456af1b619447347cd19a779b7a8f5 (diff)
Merge pull request #197 from pks-t/test-cleanups
tests: always clean up temporary repository dirs
Diffstat (limited to 'git_test.go')
-rw-r--r--git_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/git_test.go b/git_test.go
index b9cf0a9..58caf71 100644
--- a/git_test.go
+++ b/git_test.go
@@ -2,11 +2,24 @@ package git
import (
"io/ioutil"
+ "os"
"path"
"testing"
"time"
)
+func cleanupTestRepo(t *testing.T, r *Repository) {
+ var err error
+ if r.IsBare() {
+ err = os.RemoveAll(r.Path())
+ } else {
+ err = os.RemoveAll(r.Workdir())
+ }
+ checkFatal(t, err)
+
+ r.Free()
+}
+
func createTestRepo(t *testing.T) *Repository {
// figure out where we can create the test repo
path, err := ioutil.TempDir("", "git2go")