mirror of
https://github.com/grdl/git-get.git
synced 2026-02-06 09:57:55 +00:00
Add function for creating dirs for cloned repos
This commit is contained in:
13
pkg/repo.go
13
pkg/repo.go
@@ -1,6 +1,9 @@
|
||||
package pkg
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
git "github.com/libgit2/git2go/v30"
|
||||
@@ -76,3 +79,13 @@ func (r *Repo) Fetch() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func MakeDir(repoRoot, repoPath string) (string, error) {
|
||||
dir := path.Join(repoRoot, repoPath)
|
||||
err := os.MkdirAll(dir, 0775)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "Failed creating repo directory")
|
||||
}
|
||||
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user