Re: [PATCH] Use git-update-ref to update a ref during commit in git-cvsserver
- From
- Martin Langhoff <martin@catalyst.net.nz>
- Date
- Feb 27, 2007, 23:37 UTC
- Message-ID
- <45E4C0BC.5090506@catalyst.net.nz>
- In-Reply-To
- <7vmz38t5r4.fsf@assigned-by-dhcp.cox.net>
Hi Junio, Andy,
sorry for the long delay, I'm catching up with a sizable backlog at work and in my foss projects.
I like Junio's patch -- it fixes cvsserver to work with packed refs (which needed to be done!) and does things lockless, which is a great bonus.
The meat of the matter is
Junio C Hamano wrote:
Show 9 quoted lines
> - print LOCKFILE $commithash;
> + if (system(qw(git update-ref -m), "cvsserver ci",
> + "refs/heads/$state->{module}", $commithash, $parenthash)) {
> + $log->warn("update-ref for $state->{module} failed.");
> + print "error 1 Cannot commit -- update first\n";
> + exit;
> + }
>
> $updater->update();Running the commit lockless makes it a little bit more likely that we'll fail the commit after all files have been sent. Some older CVS clients have broken error handling in the late stages of the commit, but we cannot really fix that - and such cvs clients are so broken that they probably don't deserve our attention.
The other area I checked is that we don't get a nasty race condition between the update-ref and calling $updater->update() - but it is safe.
So ack from this corner and thanks for the patch!
cheers,
martin
--
-----------------------------------------------------------------------
Martin @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
OFFICE: +64(4)916-7224 UK: 0845 868 5733 ext 7224 MOB: +64(21)364-017
Make things as simple as possible, but no simpler - Einstein
-----------------------------------------------------------------------