Skip to content

"git push --cas/--lockref" renamed to "--force-with-lease"

Junio C Hamano git 3 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 7 repliesIn review
  2. v26 patches 0 repliesSuperseded
  3. v17 patches 39 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6cache.h: move remote/connect API out of itbuiltin/fetch-pack.c builtin/receive-pack.c builtin/send-pack.c +12 more+87 -700 replies
2/6builtin/push.c: use OPT_BOOL, not OPT_BOOLEANbuiltin/push.c+3 -30 replies
3/6remote.c: add command line option parser for "--force-with-lease"Documentation/git-push.txt builtin/push.c builtin/send-pack.c +2 more+168 -110 replies
4/6push --force-with-lease: implement logic to populate old_sha1_expect[]builtin/push.c builtin/send-pack.c remote.c +3 more+87 -00 replies
5/6push --force-with-lease: tie it all togetherbuiltin/send-pack.c remote.c remote.h +3 more+54 -130 replies
6/6t5533: test "push --force-with-lease"t/t5533-push-cas.sh+189 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/6] "git push --cas/--lockref" renamed to "--force-with-lease"

This is mostly unchanged since the previous round, except that

* The option is spelled "--force-with-lease=<ref>:<expect>". Nobody liked "cas" as it was too technical, many disliked "lockref" because "lock" sounded as if push by others were excluded by it while in fact this is to fail us.

The final name implies that it is related to the "--force" that breaks the "must fast-forward" safety, but "with-lease" part conveys that there is some reservation with the forcing. The observation you make before you start rebasing (or you ensure that everything is expendable and decide to delete) is like taking a lease on the ref, and as long as the lease is not broken by others, you can push a non-fast-forward history to replace what is at the remote.

* The logic to choose default when the option is not given with an explicit expected value is still "the remote-tracking branch for the ref being updated", but the documentation warns users against relying on that semantics, as it was shown to be fragile during the discussion, and hopefully we will come up with a better and more robust one to replace it.

The first two preparatory patches are the same since v2. For the remainder, other than changes necessary to rename the option, the documentation part of [PATCH 3/6] has been updated to mark forms without explicit expect value as experimental.

Junio C Hamano (6):
cache.h: move remote/connect API out of it
builtin/push.c: use OPT_BOOL, not OPT_BOOLEAN
remote.c: add command line option parser for "--force-with-lease" push --force-with-lease: implement logic to populate old_sha1_expect[] push --force-with-lease: tie it all together
t5533: test "push --force-with-lease"

 Documentation/git-push.txt |  77 +++++++++++++++---
 builtin/fetch-pack.c       |   2 +
 builtin/push.c             |  19 ++++-
 builtin/receive-pack.c     |   1 +
 builtin/send-pack.c        |  26 +++++++
 cache.h                    |  62 ---------------
 connect.c                  |   1 +
 connect.h                  |  13 ++++
 fetch-pack.c               |   1 +
 fetch-pack.h               |   1 +
 refs.c                     |   8 --
 remote.c                   | 175 +++++++++++++++++++++++++++++++++++++----
 remote.h                   |  83 ++++++++++++++++++++
 send-pack.c                |   2 +
 t/t5533-push-cas.sh        | 189 +++++++++++++++++++++++++++++++++++++++++++++
 transport-helper.c         |   6 ++
 transport.c                |  13 ++++
 transport.h                |   5 ++
 upload-pack.c              |   1 +
 19 files changed, 588 insertions(+), 97 deletions(-)
 create mode 100644 connect.h
 create mode 100755 t/t5533-push-cas.sh
Signature · 1 line
1.8.3.4-980-g8decd39