From: Petr Baudis Date: Wed, 14 Dec 2005 02:30:05 GMT Subject: Re: [PATCH] Make git-send-pack exit with error when some refs couldn't be pushed out 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 said that... > 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 and cg-diff -r ... gives expected results, etc. > 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 == , 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.