fix: ensure .git repo exists

Part of coop-cloud/organising#247.
This commit is contained in:
2021-11-15 18:54:24 +01:00
parent 299faa1adf
commit 4a245c3e02
2 changed files with 26 additions and 0 deletions

14
pkg/git/common.go Normal file
View File

@ -0,0 +1,14 @@
package git
import (
"fmt"
"os"
)
// EnsureGitRepo ensures a git repo .git folder exists
func EnsureGitRepo(repoPath string) error {
if _, err := os.Stat(repoPath); os.IsNotExist(err) {
return fmt.Errorf("no .git directory in %s?", repoPath)
}
return nil
}