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

Re: Force-with-lease and new branches

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2016, 18:29 UTC
Message-ID
<xmqqfutsz9lw.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160507180914.GR14612@serenity.lan>
John Keeping <john@keeping.me.uk> writes:
> It looks like this has been the case since the first version of what
> would become --force-with-lease [1] and I can't find any discussion
> around this particular behaviour in the three versions of that patch set
> I found on Gmane [2], [3], [4].

I never considered the "creation of a new ref, ensuring that it must not exist yet" use case when designing it. I do not think anybody in the discussion did so, either.

> So my questions are: what will break if we decide to treat "no remote
> tracking branch" as "new branch" and is that a reasonable thing to do?

If you are only following a subset of branches they have, you may never get copies of them in your refs/remotes/$there/ hierarchy, so your addition would make 'force-with-lease to create' mistakenly think that a branch does not exist over there, when there is already one, and it will attempt to push your version through. As long as that is caught and fail on the receiving end of the request, it is OK, I would think. I didn't think it through nor checked the code to make sure the remote end behaves sensibly--please do so yourself if you want to pursue this route ;-).

Thanks.
Previous: John Keeping
Message 2 of 2 in “Force-with-lease and new branches”
  1. John KeepingMay 7, 2016
  2. Junio C HamanoMay 8, 2016

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.