On Thu, Jul 6, 2017 at 3:39 PM, Junio C Hamano <[email protected]> wrote:
> Stefan Beller <[email protected]> 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 push
But 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.