Re: What's cooking in git.git (Feb 2014, #06; Wed, 19)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 24, 2014, 16:57 UTC
- Message-ID
- <xmqqtxbobg98.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <8732A8C8-145E-47F5-BD9A-ECD6E9DE07EF@quendi.de>
Max Horn <max@quendi.de> writes:
Show 15 quoted lines
> On 21.02.2014, at 19:04, Junio C Hamano <gitster@pobox.com> wrote: > >> Isn't it possible for some helpers to _do_ want to >> tell us that it did not have to force after all by _not_ saying >> "forced update" and overwrite ->forced_update with zero? > > Yes to the first part, no to the last bit: Yes, a transport helper > can (and frequently does) tell us that no force happened -- by not > saying "forced update". > ... >> How do we tell helpers that do want to do so apart from other >> helpers that say "forced update" only when they noticed they are >> indeed forcing? > > I am not completely sure I even understand that bit?
I think I phrased it too imprecisely.
If nobody even knew about the "forced update" before hg helper, then they by definition do not wish to overwrite, of course. But I was worried if we are closing the door for this possible scenario:
* the calling side sets ref->forced_update to true before invoking the helper, knowing that this update is not fast-forward; and
* the helper does a "magic" (after all, we are talking with an external mechanism, which may be a different SCM like darcs) to rebase our change on top of the history that the other side already have, and makes it a fast-forward, non-forced push.
Such a helper would want a way to say "You may have thought that this does not fast-forward, but the push result ended up to be a fast-forward update", and if we wanted to support that, one thing we may need to allow it to do is to reset ref->forced_update to zero.
But I think I was worried too much into the future---I agree that the code can stay as you proposed until such a remote-helper needs more support, because "overwrite with zero" is necessary but is probably not sufficient---it also may need to be able to tell us what the final resulting commit of the push is, for example.