Re: [PATCH] push: disable lazy --force-with-lease by default
- From
Stefan Beller <sbeller@google.com>
- Date
- Jul 10, 2017, 22:32 UTC
- Message-ID
- <CAGZ79ka3ZA_9kE+b=bC28dG5fW3REgC0Ecfn7vie1eRiExxOjg@mail.gmail.com>
- In-Reply-To
- <xmqqk23ldwbv.fsf@gitster.mtv.corp.google.com>
On Thu, Jul 6, 2017 at 3:39 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> Stefan Beller <sbeller@google.com> writes: > >>> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt >>> index 0a639664fd..1fa01210a2 100644 >>> --- a/Documentation/git-push.txt >>> +++ b/Documentation/git-push.txt >>> @@ -212,8 +212,9 @@ must not already exist. >>> + >>> Note that all forms other than `--force-with-lease=<refname>:<expect>` >>> that specifies the expected current value of the ref explicitly are >>> -still experimental and their semantics may change as we gain experience >> >> This indicates that this feature is not 'experimental' any more, but disabled >> (for safety reasons as described below). This implies we will not change the >> heuristic for push.allowLazyForceWithLease easily. > > I actually wanted to say it was a failed experiment, but I see your > point. Let's leave the "still experimental" label. >
After rethinking this feature and how to make it safer, we could actually *ask* the user to confirm the sha1:
# implicit lease:
$ git push --force-with-lease <remote/refspec>
# either do an implicit fetch for the refspec first
# or use the remote tracking branch:
This would lose HEAD=27956ac767, including
the following commits on <remote/refspec> :
27956ac767 Merge branch 'js/rebase-i-final' into pu
a1b1c5eb04 Merge branch 'sb/hashmap-cleanup' into pu
... and 13 more
Confirm to lose commits by typing yes: yes
... normal pushBut that may be more effort than this patch originally intended to be, but I would think this makes the lease effective.
Downside is the I/O (Have we any command that is taking user input as such? -p option for reset/add may come to mind) and the unfriendlyness to scripts, but scripting may rely on the non-lazy form of leases.