mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 17:51:44 +03:00
git: minor cleanup
This commit is contained in:
parent
1dc106279a
commit
6a0336e04b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user