[PATCH v5 0/3] push: add "--[no-]force-if-includes"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a new option: "--force-if-includes" to "git-push" where forced
updates are allowed only if the tip of the remote-tracking ref has
been integrated locally, by verifying if the tip of the remote-tracking
ref -- on which a local branch has based on -- is reachable from at
least one of the "reflog" entries of the branch about to be updated
by force on the remote.

This option can be used with "--force-with-lease" with setups where
the remote-tracking refs of the repository are implicitly updated in
the background to help prevent unintended remote overwrites.

If a local branch is based on a remote ref for a rewrite, and if that
remote-tracking ref is updated by a push from another repository after
it has been checked out locally, force updating that branch to remote
with "--force-with-lease[=<refname>[:<expect>]]" without specifying
the "<expect>" value, can cause the update that happened in-between the
checkout and forced push to be lost.

Changes since v4:
  - Collect commits during the reflog iteration step and use
    "in_merge_bases_many()" once on the list of collected commits
    instead of using "in_merge_bases()" for every entry [1].

  - Include reflog timestamps to reduce the number of reflog entry
    iterations by stopping early if we see an entry that is older
    than the remote tip's commit date [2]. This, coupled with a
    single call of "in_merge_bases_many()" should help make the
    check faster [3].

  - Reword commit messages, documentation; add a note to explain
    when the option is a "no-op".

  - Fix a mistake in the test script (t5533).

Srinidhi Kaushik (3):
  push: add reflog check for "--force-if-includes"
  push: parse and set flag for "--force-if-includes"
  t, doc: update tests, reference for "--force-if-includes"

 Documentation/config/advice.txt |   9 +-
 Documentation/config/push.txt   |   6 ++
 Documentation/git-push.txt      |  26 +++++-
 advice.c                        |   3 +
 advice.h                        |   2 +
 builtin/push.c                  |  27 ++++++
 builtin/send-pack.c             |  12 +++
 remote-curl.c                   |  14 +++-
 remote.c                        | 140 +++++++++++++++++++++++++++++++-
 remote.h                        |   8 +-
 send-pack.c                     |   1 +
 t/t5533-push-cas.sh             |  53 ++++++++++++
 transport-helper.c              |  10 +++
 transport.c                     |   8 ++
 transport.h                     |  15 ++--
 15 files changed, 321 insertions(+), 13 deletions(-)

base-commit: 385c171a018f2747b329bcfa6be8eda1709e5abd

Thanks to Johannes, Junio and Phillip for continually suggesting
improvements and patiently reviewing the patch series.

[1]: https://public-inbox.org/git/xmqqft7djzz0.fsf@xxxxxxxxxxxxxxxxxxxxxx/
[2]: https://public-inbox.org/git/f6bb2b1f-0f1b-f196-59f1-893580430cf2@xxxxxxxxx/
[3]: https://public-inbox.org/git/xmqqimc7ezk2.fsf@xxxxxxxxxxxxxxxxxxxxxx/
--
2.28.0



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux