aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git_testing.go
diff options
context:
space:
mode:
authorSebastien Devaux <sebastien.devaux@laposte.net>2019-08-27 21:35:04 +0200
committerSebastien Devaux <sebastien.devaux@laposte.net>2019-08-27 21:35:04 +0200
commitddcbd8d022af0451ff87734fb443b27f98a490dd (patch)
treeaa0262fe758f931e8eec0be32c2dd9a9aaf84d75 /repository/git_testing.go
parent7e123fbfcae76e3ad188cfa5e98c27adcde8d6d7 (diff)
downloadgit-bug-ddcbd8d022af0451ff87734fb443b27f98a490dd.tar.gz
issue 178: adding required changes to InitGitRepo and CleanupTestRepos
Diffstat (limited to 'repository/git_testing.go')
-rw-r--r--repository/git_testing.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/repository/git_testing.go b/repository/git_testing.go
index dd597a8e..b844fbbe 100644
--- a/repository/git_testing.go
+++ b/repository/git_testing.go
@@ -1,6 +1,7 @@
package repository
import (
+ "strings"
"io/ioutil"
"log"
"os"
@@ -44,6 +45,17 @@ func CleanupTestRepos(t testing.TB, repos ...Repo) {
var firstErr error
for _, repo := range repos {
path := repo.GetPath()
+ if (strings.HasSuffix(path,"/.git")) {
+ // non bare repository, remove complete repos not
+ // only git meta data.
+ path=strings.TrimSuffix(path,"/.git");
+ // Testing non bare repo should also check path is
+ // only .git (i.e. ./.git), but doing so, we should
+ // try to remove the current directory and hav some
+ // trouble. In the present case, this case should not
+ // occure.
+ // TODO consider warning or error when path == ".git"
+ }
// fmt.Println("Cleaning repo:", path)
err := os.RemoveAll(path)
if err != nil {