Skip to content

Commit

Permalink
Tidy git resource logic
Browse files Browse the repository at this point in the history
We should always ensure permissions rather than returning early.
  • Loading branch information
surminus committed May 31, 2023
1 parent d545008 commit 21452c4
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions resources/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,7 @@ func (g *Git) createGit(log *viaduct.Logger) error {
return nil
}

var pathExists bool
if viaduct.FileExists(path) {
if !g.Ensure {
log.Noop(logmsg)
return nil
}

pathExists = true
}

if pathExists {
if viaduct.FileExists(path) && g.Ensure {
r, err := git.PlainOpen(path)
if err != nil {
return err
Expand All @@ -150,7 +140,6 @@ func (g *Git) createGit(log *viaduct.Logger) error {

// nolint:exhaustivestruct
err = w.Pull(&git.PullOptions{
// Auth: auth,
RemoteName: "origin",
Progress: os.Stdout,
ReferenceName: plumbing.ReferenceName(g.Reference),
Expand All @@ -166,7 +155,7 @@ func (g *Git) createGit(log *viaduct.Logger) error {
}
}

if !pathExists {
if !viaduct.FileExists(path) {
progress := os.Stdout

if viaduct.Config.Quiet || viaduct.Config.Silent {
Expand Down

0 comments on commit 21452c4

Please sign in to comment.