Skip to content

Commit

Permalink
fix(clone): omit checkout depth if it is zero (runatlantis#3188)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode authored and ijames-gc committed Feb 13, 2024
1 parent e4fa26c commit 0b3a29c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions server/events/working_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,17 @@ func (w *FileWorkspace) forceClone(log logging.SimpleLogging,
fetchRef = fmt.Sprintf("pull/%d/head:", p.Num)
fetchRemote = "origin"
}
if err := runGit("fetch", "--depth", fmt.Sprint(w.CheckoutDepth), fetchRemote, fetchRef); err != nil {
return err
}

// if no checkout depth, omit depth arg
if w.CheckoutDepth == 0 {
if err := runGit("fetch", fetchRemote, fetchRef); err != nil {
return err
}
} else {
if err := runGit("fetch", "--depth", fmt.Sprint(w.CheckoutDepth), fetchRemote, fetchRef); err != nil {
return err
}
}

if w.GpgNoSigningEnabled {
if err := runGit("config", "--local", "commit.gpgsign", "false"); err != nil {
Expand Down

0 comments on commit 0b3a29c

Please sign in to comment.