Skip to content

Commit

Permalink
fix(repositories): reset if repo has diverged (#3210)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin authored and bnjjj committed Aug 17, 2018
1 parent b23f879 commit b4873be
Show file tree
Hide file tree
Showing 13 changed files with 2,717 additions and 595 deletions.
652 changes: 57 additions & 595 deletions Gopkg.lock

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions engine/repositories/processor_checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ func (s *Service) processCheckout(op *sdk.Operation) error {
return err
}

//Check is repo has diverged
hasDiverged, err := gitRepo.HasDiverged()
if err != nil {
log.Error("Repositories> processCheckout> HasDiverged> [%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 = d
}
Expand Down
11 changes: 11 additions & 0 deletions vendor/github.com/fsamin/go-repo/repo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

683 changes: 683 additions & 0 deletions vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go

Large diffs are not rendered by default.

238 changes: 238 additions & 0 deletions vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4873be

Please sign in to comment.