Junio C Hamano wrote: > The background behind this is around beginning of February 2006, > the thread "Two ideas" by Carl Worth. And the current behaviour > is defined by this commit. I'll talk about a possible > improvement but first, here is what it does: > > commit 130fcca63fe8e7e087e7419907e018cbbaf434a3 > Author: Junio C Hamano <junkio@cox.net> > Date: Sun Feb 5 00:07:44 2006 -0800 > > > 2. refuses to run if named paths... are different in HEAD and > the index (ditto about reminding). Added paths are OK. > > > The check that prevents you from doing > > $ edit A B > $ git update-index A B > $ git commit -o B > > is the rule #2, which I think could use further improvement. It > is to address the "committing skewed files" issue Carl brought > up in that thread. > > It might be better to further check if the working tree file is > the same as the index, and to allow a commit in such a case. > > The intent of rule #2 is to prevent this from happening: > > $ edit A B > $ git update-index A B > $ edit B again > $ git commit -o B > > When this happens, the real index will have _old_ contents of B > that never was committed, and does not match what is in the > index. But after the commit, we will match the real index to > what was committed, so we will _lose_ the index entry for B > before the second edit you explicitly told git to remember by > saying 'update-index'. > Can't this be done by updating .git/index first and then use the temporary index to commit? Then .git/index would match the current tree and everybody would be happy with very little tweaking. Doing the temporary index commit first could cause data-loss as described above if the updating of .git/index somehow fails and the user is unaware of it (or what to do to fix it). -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Thu Mar 16 01:01:16 2006
This archive was generated by hypermail 2.1.8 : 2006-03-16 01:01:29 EST