Skip to content

Commit

Permalink
fix(clone): omit checkout depth if it is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode committed Mar 3, 2023
1 parent 47cb6bd commit 6a54a23
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions server/events/working_dir.go
Expand Up @@ -285,9 +285,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 6a54a23

Please sign in to comment.