git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Jul 2017, #03; Mon, 10)

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 13, 2017, 12:44 UTC
Message-ID
<alpine.DEB.2.21.1.1707131435220.4193@virtualbox>
In-Reply-To
<xmqqlgnv52oq.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Mon, 10 Jul 2017, Junio C Hamano wrote:
Show 11 quoted lines
> * jc/allow-lazy-cas (2017-07-06) 1 commit
>  - push: disable lazy --force-with-lease by default
> 
>  Because "git push --force-with-lease[=<ref>]" that relies on the
>  stability of remote-tracking branches is unsafe when something
>  fetches into the repository behind user's back, it is now disabled
>  by default.  A new configuration variable can be used to enable it
>  by users who know what they are doing.  This would pave the way to
>  possibly turn `--force` into `--force-with-lease`.
> 
>  Will wait for feedback, then merge to and cook in 'next'.

I wonder whether the --force-with-lease option would benefit (and counter the "unsafe because of behind-the-back operations" argument) from doing some kind of "reverse pull --rebase".

In other words, --force-with-lease could verify that the upstream branch has no commits that weren't seen in the current branch's reflog, i.e. that `git rev-parse HEAD@{upstream}` is identical to `git merge-base --fork-point HEAD HEAD@{upstream}`.

The assumption would be that you typically want to push with a lease only when following the `pull --rebase` workflow. Meaning that you would only want to force-push when your local branch had the upstream branch integrated at some stage [*1*].

I could imagine, though, that this should be an opt-in option for now, and could be turned into an opt-out option later. Or maybe just make it opt-out, adding a kick-ass error message explaining the situation properly (and how to override the safe-guard from the command-line).

Ciao, Dscho

Footnote *1*: Of course, if you merge upstream, do some stuff and then reset --hard to the previous state, this safeguard will not catch. It would *still* catch when aborting a rebase onto upstream, though.

Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 17 in “What's cooking in git.git (Jul 2017, #03; Mon, 10)”
  1. Junio C HamanoJul 10, 2017
  2. Lars SchneiderJul 11, 2017
  3. Jeff KingJul 11, 2017
  4. Lars SchneiderJul 11, 2017
  5. Jeff KingJul 11, 2017
  6. Junio C HamanoJul 11, 2017
  7. Junio C HamanoJul 11, 2017
  8. Johannes SchindelinJul 13, 2017
  9. Junio C HamanoJul 13, 2017
  10. Jeff KingJul 13, 2017
  11. Junio C HamanoJul 13, 2017
  12. Junio C HamanoJul 13, 2017
  13. Jeff KingJul 13, 2017
  14. Junio C HamanoJul 13, 2017
  15. Junio C HamanoJul 13, 2017
  16. Jeff KingJul 13, 2017
  17. Junio C HamanoJul 13, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.