[PATCH] cvsserver: imitate git-update-ref when committing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git-update-ref writes into the lockfile, and renames it afterwards. Like 
commit v1.3.0-rc3~22, it is not only cleaner, but also helps with shared 
setups: every developer can have a different primary group; what matters 
is that $GIT_DIR/refs/heads has to be writable by a group you are in.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx>
---
 git-cvsserver.perl |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 1b70cd9..2c1b0c7 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -1144,9 +1144,7 @@ sub req_ci
         exit;
     }
 
-    open FILE, ">", "$ENV{GIT_DIR}refs/heads/$state->{module}";
-    print FILE $commithash;
-    close FILE;
+    print LOCKFILE $commithash;
 
     $updater->update();
 
@@ -1173,7 +1171,9 @@ sub req_ci
     }
 
     close LOCKFILE;
-    unlink($lockfile);
+    my $reffile = "$ENV{GIT_DIR}refs/heads/$state->{module}";
+    unlink($reffile);
+    rename($lockfile, $reffile);
     chdir "/";
 
     print "ok\n";
-- 
1.4.2.rc2.g2b3d-dirty

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]