From 8128bb79b0db9023a98c356e4e173d846057c577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Tue, 8 Dec 2020 15:09:58 +0100 Subject: [PATCH] repo: close before deleting --- repository/git.go | 5 +++++ repository/gogit.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/repository/git.go b/repository/git.go index 993e6cc6..bc9d8772 100644 --- a/repository/git.go +++ b/repository/git.go @@ -488,6 +488,11 @@ func (repo *GitRepo) GetLocalRemote() string { // EraseFromDisk delete this repository entirely from the disk func (repo *GitRepo) EraseFromDisk() error { + err := repo.Close() + if err != nil { + return err + } + path := filepath.Clean(strings.TrimSuffix(repo.path, string(filepath.Separator)+".git")) // fmt.Println("Cleaning repo:", path) diff --git a/repository/gogit.go b/repository/gogit.go index 74fe3fc5..bdac259d 100644 --- a/repository/gogit.go +++ b/repository/gogit.go @@ -734,6 +734,11 @@ func (repo *GoGitRepo) GetLocalRemote() string { // EraseFromDisk delete this repository entirely from the disk func (repo *GoGitRepo) EraseFromDisk() error { + err := repo.Close() + if err != nil { + return err + } + path := filepath.Clean(strings.TrimSuffix(repo.path, string(filepath.Separator)+".git")) // fmt.Println("Cleaning repo:", path)