Skip to content

Commit

Permalink
fix: skip empty commits
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Dellaluce <[email protected]>
  • Loading branch information
jasondellaluce committed Feb 26, 2024
1 parent c2820d9 commit 4b21ed8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ func applyAllPatches(ctx context.Context, git utils.GitHelper, req *Request, sca
return multierror.Append(err, recoveryErr, git.Do("reset", "--hard"))
}
recovered = true
continueErr := git.Do("cherry-pick", "--allow-empty", "--continue")
if hasChanges, changesErr := git.HasLocalChanges(); changesErr != nil {
logrus.Error("failed checking for remaining changes, reverting patch")
return multierror.Append(err, changesErr, git.Do("reset", "--hard"))
} else if !hasChanges {
logrus.Warn("cherry-pick is now empty possibly due to conflict resolution, skipping commit")
continue
}
continueErr := git.Do("cherry-pick", "--continue")
if continueErr != nil {
logrus.Error("failed continuing cherry-pick, reverting patch")
return multierror.Append(err, continueErr, git.Do("reset", "--hard"))
Expand Down

0 comments on commit 4b21ed8

Please sign in to comment.