diff options
author | Michael Muré <batolettre@gmail.com> | 2020-12-08 15:17:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 15:17:22 +0100 |
commit | bf476f98d1656850e2f3fd349adea504007a8313 (patch) | |
tree | 595f3875590c89fe1c5a30e2e732f8aee9b35361 /repository/repo_testing.go | |
parent | 54d123c6753d053df8400beea316e13690c851f4 (diff) | |
parent | 8128bb79b0db9023a98c356e4e173d846057c577 (diff) | |
download | git-bug-bf476f98d1656850e2f3fd349adea504007a8313.tar.gz |
Merge pull request #510 from MichaelMure/repo-rework
Repo rework
Diffstat (limited to 'repository/repo_testing.go')
-rw-r--r-- | repository/repo_testing.go | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/repository/repo_testing.go b/repository/repo_testing.go index 41b3609e..c0e1fa79 100644 --- a/repository/repo_testing.go +++ b/repository/repo_testing.go @@ -3,8 +3,6 @@ package repository import ( "log" "math/rand" - "os" - "strings" "testing" "github.com/stretchr/testify/require" @@ -15,25 +13,13 @@ import ( func CleanupTestRepos(repos ...Repo) { var firstErr error for _, repo := range repos { - path := repo.GetPath() - 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 - // occur. - // TODO consider warning or error when path == ".git" - } - // fmt.Println("Cleaning repo:", path) - err := os.RemoveAll(path) - if err != nil { - log.Println(err) - if firstErr == nil { - firstErr = err + if repo, ok := repo.(TestedRepo); ok { + err := repo.EraseFromDisk() + if err != nil { + log.Println(err) + if firstErr == nil { + firstErr = err + } } } } |