Skip to content

Commit

Permalink
adjust ACLs on Repo Clone
Browse files Browse the repository at this point in the history
  • Loading branch information
steiler committed Nov 14, 2023
1 parent 3b3cbef commit 09405d2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/storage/memory"
log "github.com/sirupsen/logrus"
"github.com/srl-labs/containerlab/utils"
)

type GoGit struct {
Expand Down Expand Up @@ -216,6 +217,12 @@ func (g *GoGit) cloneNonExisting() error {
}
co.ReferenceName = plumbing.NewBranchReferenceName(branchName)
}
// pre-create the repo directory and adjust the ACLs
utils.CreateDirectory(g.gitRepo.GetName(), 0755)
err = utils.AdjustFileACLs(g.gitRepo.GetName())
if err != nil {
log.Warnf("failed to adjust repository (%s) ACLs. continuin anyways", g.gitRepo.GetName())
}

// perform clone
g.r, err = gogit.PlainClone(g.gitRepo.GetName(), false, co)
Expand Down

0 comments on commit 09405d2

Please sign in to comment.