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

Re: [PATCH] Make git-send-pack exit with error when some refs couldn't be pushed out

From
Petr Baudis <pasky@suse.cz>
Date
Dec 14, 2005, 02:30 UTC
Message-ID
<20051214023005.GS10680@pasky.or.cz>
In-Reply-To
<7vbqzk5tx1.fsf@assigned-by-dhcp.cox.net>

Dear diary, on Wed, Dec 14, 2005 at 02:50:02AM CET, I got a letter where Junio C Hamano <junkio@cox.net> said that...

Show 8 quoted lines
> However, I am not quite sure if the recent change to Cogito to
> update the mirror of remote branch is a good one.  Since I am
> not a Cogito user, I did not question it when I saw the change,
> but I wondered what you are using the cached "remote ref is
> supposed to be pointing at this commit" knowledge for.  If it is
> only "pretending to have fetched the remote branch immediately
> after we pushed into it before anybody else touched the same
> remote branch", then it probably is benign.

Exactly, we're just pretending that. It's useful since cg-fetch's diff-tree output is less confusing then, cg-log -r <remotebranch> and cg-diff -r ... gives expected results, etc.

Show 14 quoted lines
> But this bit puzzles and worries me:
> 
> > ... otherwise
> > it gets out of sync, which can lead even to loss of commits on the local
> > side (this happenned to Jonas Fonseca - thanks for the report, BTW).
> 
> I do not remember seeing that report so I do not know how that
> lossage happens with unreleased Cogito, but I suspect there is
> something very fishy going on here.  I presume it happens when
> the next fetch/pull from the remote is run, but if the locally
> cached information can affect the next fetch/pull in such a way,
> wouldn't updates by other people to the shared remote repository
> branch also cause things to go out-of-sync and cause the same
> breakage?

Jonas only reported it on IRC as weird cg-commit behaviour (which it appeared to be, but the cause turned out to be this and the nice side-effect that this kind of breakage cannot lose you actual data at least, just metadata).

If the push really happened, this shouldn't be a problem, since then we get into a "fast-forward relation" to the remote branch, and commits by other people don't affect it either, since they don't break this relation. The "interesting behaviour" Cogito implements happens only if your current HEAD == <the_old_remote_head>, which can't happen when other people commit, only when you push it out to the remote head.

What kicks in is the fast-forward behaviour change I proposed quite some time ago on the mailing list and got zero feedback about --- when updating from a remote branch, the Cogito 0.17pre's fast-forward test is extended from

	if (head ancestor_of remote_new)
to
	if (head ancestor_of remote_new OR head == remote_old)

which will make fast-forward able to follow even remote rebases and should have no negative side-effects as long as remote_old was correct (which it is except when our bug comes out). So in the reported case, remote_old was set to head, while remote_new stayed as before, and Cogito therefore thought that the remote branch just got rebased from head to remote_new, and adjusted the head appropriately.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
Previous: Junio C HamanoNext: Jon Loeliger
Message 3 of 5 in “Make git-send-pack exit with error when some refs couldn't be pushed out”
  1. Make git-send-pack exit with error when some refs couldn't be pushed outPetr Baudis, Dec 14, 2005
  2. Junio C HamanoDec 14, 2005
  3. Petr BaudisDec 14, 2005
  4. Jon LoeligerDec 14, 2005
  5. Petr BaudisDec 14, 2005

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.