diff options
author | Michael Muré <batolettre@gmail.com> | 2019-08-31 13:21:44 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-08-31 13:21:44 +0200 |
commit | 6a0336e04b17bf232375be880a410a0531b9f7ff (patch) | |
tree | 11fbb5a4f4e847eb0e043481a386b6ad61b352da /repository | |
parent | 1dc106279a883ca4aac2b1489ef8d4a441284899 (diff) | |
download | git-bug-6a0336e04b17bf232375be880a410a0531b9f7ff.tar.gz |
git: minor cleanup
Diffstat (limited to 'repository')
-rw-r--r-- | repository/git_testing.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/repository/git_testing.go b/repository/git_testing.go index b844fbbe..36c53c1d 100644 --- a/repository/git_testing.go +++ b/repository/git_testing.go @@ -1,10 +1,10 @@ package repository import ( - "strings" "io/ioutil" "log" "os" + "strings" "testing" ) @@ -45,15 +45,16 @@ 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 + if strings.HasSuffix(path, "/.git") { + // for a normal repository (not --bare), we want to remove everything + // including the parent directory where files are checked out + 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. + // occur. // TODO consider warning or error when path == ".git" } // fmt.Println("Cleaning repo:", path) |