From: Marco Costalba Date: Sun, 08 Jul 2007 13:49:27 GMT Subject: Re: [Qgit RFC] commit --amend Message-ID: In-Reply-To: <20070708133825.GE3991@efreet.light.src> On 7/8/07, Jan Hudec wrote: > On Fri, Jul 06, 2007 at 10:12:50 +0200, Marco Costalba wrote: > > On 7/5/07, Jan Hudec wrote: > >> Therefore I'll either have to always ask git via run("git-rev-parse HEAD", > >> head), add HEAD into the map, or store HEAD somewhere in the Git object. > >> Which do you think makes most sense? > > > > Asking git when you need it and keep HEAD value only for the minimum > > time required to execute the commit command. > > > > - HEAD is very 'volatile' > > > > - commit is _not_ performance critical. > > > > - commit, being a write operation, is instead bugs/misbehaviour > > critical (a big point to use an high level "git-commit" BTW) > > > > - asking git with getRefSha("HEAD", ANY_REF, true) is very quick and > > in any case much quicker then the whole commit dance. > > Yes. It is also much faster to write in code, but... > > > - someone can always change the repo behind you, qgit is not the only > > interface to git ;-) does exist also the command line. > > And the commit in qgit should better fail loudly if that happens, because the > list of files or something else might no longer make sense. > > There is actually just one thing I need the head for -- passing it as 3rd > argument to git-update-ref. That should be done purely as safety measure -- > if the value does not match, the command will fail. And for that safety > measure to be useful, I need value of the head at the time user openend the > commit dialog, NOT the time user clicked on commit button. > It it has "commit dialog" life span I would suggets to save in a "commit dialog" object member data. Marco