Support reformat-on-merge
This is a bit involved. To reduce workflow churn on an MR, format checking should be able to be deferred to right before merging. I can think of two strategies off-hand:
- silence reformat errors from the check (but still collate its status)
-
Do: merge --reformat
will ignore the check status, perform a reformat up to N times looking for a fix point, and if that checks out OK with formatting enforced, push the reformat to the MR and then perform the merge and push it to the main repo. - Once that push works, delete the source branch if requested
or:
- don't run reformat checks
- on merge, reformat and push if necessary
- if pushed, copy trailers active during the
Do: merge
command and issue anotherDo: merge --author @original.merger
command to itself (--author
usage will only be honored if it came from the robot account)
The former does have a race where we can update the MR, but lose the merge push. This is fine and a new Do: merge
can fix it (trailers will need to be copied in this case).
Selecting between them could be an option, but I don't think they actually share that much code at this level. The former sounds a lot better to me.