Subject: [PATCH] Use git-update-ref to update a ref during commit in git-cvsserver

From: Andy Parkins <[email-masked]>
Date: Tue, 20 Feb 2007 20:10:01 +0000

Nicholas Pitre mentioned that updating a reference should be done with
git-update-ref.

This patch does that and includes the -m option to have the reflog
updated as a bonus.

Signed-off-by: Andy Parkins <[email-masked]>
---
As promised...

 git-cvsserver.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index b4ef6bc..54d943a 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -1216,9 +1216,9 @@ sub req_ci
     }
 
     close LOCKFILE;
-    my $reffile = "$ENV{GIT_DIR}refs/heads/$state->{module}";
-    unlink($reffile);
-    rename($lockfile, $reffile);
+    my $reffile = "refs/heads/$state->{module}";
+	`git-update-ref -m "git-cvsserver commit" $reffile $commithash $parenthash`;
+	unlink($lockfile);
     chdir "/";
 
     print "ok\n";
-- 
1.5.0.rc4.gb4d2