Subject: Re: [PATCH 7/7] push: document --lockref

From: Marc Branchaud <[email-masked]>
Date: Tue, 09 Jul 2013 17:37:38 -0400

On 13-07-09 04:37 PM, Junio C Hamano wrote:
> Johannes Sixt <[email-masked]> writes:
> 
>> Am 09.07.2013 21:53, schrieb Junio C Hamano:
>>> +--lockref::
>>> +--lockref=<refname>::
>>> +--lockref=<refname>:<expect>::
>>> ...
>>> +This is meant to make `--force` safer to use.
>>
>> This is a contradiction. "--force" means "I mean it, dude", and not "I
>> mean it sometimes". It would make sense if this sentence were "This is
>> meant to make `+refspec` safer to use."
> 
> No, this *IS* making --force safer by letting you to say in addition
> to --force alone which is blind, add --lockref to defeat it.
> 
> I do not see any good reason to change the samentics of "+refspec"
> for something like this.  "+refspec" and "--force refspec" have
> meant the same thing forever.  If --lockref adds safety to +refspec,
> the same safety should apply to "--force refspec".
> 
>> Do you intend to require users to opt in to safety by saying --lockref
>> until the end of time?
> 
> For normal users this is *NOT* necessary.  I do not know where
> people are getting the idea of making it default.
> 
> Rewinding a branch, needing to --force, is an exceptional case.

Yes, rewinding is exceptional.

However, when a rewind has to happen, I think most users would want to have
this feature most of the time.  I think anyone who rewinds a shared branch
would hate to inadvertently throw away someone else's work.  Rare is the
person who really won't care about that.

So I agree with those who say that this would be nice default behaviour.  I
also don't think we need to make --force different from +refspec, mainly
because if the rewound ref turns out to have moved a simple "git fetch" will
update it and likely allow the next rewind attempt to succeed.  A helpful
error message would make this plain.

I also appreciate the desire to let this stew a while before making it the
default.  However, I don't think that leaving it as an option of push will
give it enough exposure.  I myself want this feature, and I do rewind or
delete a branch every few months or so, but I'm almost certainly going to
forget to use this option the next time the need arises.

But if it was instead/also a configurable option I could just turn on, that
would be awesome.

<bikeshed>
For the option name, how about --match-baseref ?
</bikeshed>

		M.