Skip to content

Commit

Permalink
fix(repositories): always reset hard (#4282)
Browse files Browse the repository at this point in the history
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
  • Loading branch information
yesnault committed May 13, 2019
1 parent 432ccee commit e81e4cb
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions engine/repositories/processor_checkout.go
Expand Up @@ -11,20 +11,11 @@ func (s *Service) processCheckout(op *sdk.Operation) error {
return sdk.WrapError(err, "unable to process gitclone")
}

//Check is repo has diverged
hasDiverged, err := gitRepo.HasDiverged()
if err != nil {
log.Error("Repositories> processCheckout> HasDiverged> [%s] Error: %v", op.UUID, err)
if err := gitRepo.ResetHard("origin/" + currentBranch); err != nil {
log.Error("Repositories> processCheckout> ResetHard> [%s] Error: %v", op.UUID, err)
return err
}

if hasDiverged {
if err := gitRepo.ResetHard("origin/" + currentBranch); err != nil {
log.Error("Repositories> processCheckout> ResetHard> [%s] Error: %v", op.UUID, err)
return err
}
}

if op.Setup.Checkout.Branch == "" {
op.Setup.Checkout.Branch = op.RepositoryInfo.DefaultBranch
}
Expand Down

0 comments on commit e81e4cb

Please sign in to comment.