8000 fix(repositories): always reset hard (#4282) · ovh/cds@e81e4cb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit e81e4cb

Browse files
authored
fix(repositories): always reset hard (#4282)
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
1 parent 432ccee commit e81e4cb

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

engine/repositories/processor_checkout.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,11 @@ func (s *Service) processCheckout(op *sdk.Operation) error {
1111
return sdk.WrapError(err, "unable to process gitclone")
1212
}
1313

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

21-
if hasDiverged {
22-
if err := gitRepo.ResetHard("origin/" + currentBranch); err != nil {
23-
log.Error("Repositories> processCheckout> ResetHard> [%s] Error: %v", op.UUID, err)
24-
return err
25-
}
26-
}
27-
2819
if op.Setup.Checkout.Branch == "" {
2920
op.Setup.Checkout.Branch = op.RepositoryInfo.DefaultBranch
3021
}

0 commit comments

Comments
 (0)
0