This patch improves how the remote helper handles divergence.
Without quorum for the default branch, the remote helper would report an error, suggesting that the patch was not updated, while, inconsistently, actually updating the ref in storage without creating a new revision.
$ git push …
To rad://z…5/z…z
…
! [remote rejected] 612… -> patches/a77… (…)
error: failed to push some refs to 'rad://z…5/z…z'
…
$ git ls-remote rad://z…5/z…z
612… refs/heads/patches/a77…
This is very confusing.
Fix this by only calling push_ref after the base of the revision
(and the user provided a message, just in case that errors) is known.
While at it, also move the logic into patch_base and share it
between patch_open and patch_update. Computation of the canonical
head via stored.canonical_head is moved to a branch that is only
taken if the user did not specify a base explicitly. This allows to
update patches even when there is no quorum for the default branch.
remote-helper: Check base when matching revisions
It is impossible to preserve the head of a revision and only change the base of same revision via push.
Strenghthen the precondition for skipping updates to also consider the base commit.
This patch improves how the remote helper handles divergence.
Without quorum for the default branch, the remote helper would report an error, suggesting that the patch was not updated, while, inconsistently, actually updating the ref in storage without creating a new revision.
$ git push …
To rad://z…5/z…z
…
! [remote rejected] 612… -> patches/a77… (…)
error: failed to push some refs to 'rad://z…5/z…z'
…
$ git ls-remote rad://z…5/z…z
612… refs/heads/patches/a77…
This is very confusing.
Fix this by only calling push_ref after the base of the revision
(and the user provided a message, just in case that errors) is known.
While at it, also move the logic into patch_base and share it
between patch_open and patch_update. Computation of the canonical
head via stored.canonical_head is moved to a branch that is only
taken if the user did not specify a base explicitly. This allows to
update patches even when there is no quorum for the default branch.
remote-helper: Check base when matching revisions
It is impossible to preserve the head of a revision and only change the base of same revision via push.
Strenghthen the precondition for skipping updates to also consider the base commit.
Fix commit message.
Fix
REVIEW
Generally, looks good to me and nice use of Drop.
Review consists of:
- A crucial change in using
and_thenrather thanmap - A nit in naming of the struct
Squash in review.
Rebase