cvsserver: imitate git-update-ref when committing
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@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Jul 26, 2006 at 22:51 UTC
cadbcf2712ff346dcd757d0b116359380920b2a4
1 file changed
+4
-4
git-cvsserver.perl
+4
-4
@@ -1142,9 +1142,7 @@ sub req_ci
1142
exit;
1143
}
1144
1145
- open FILE, ">", "$ENV{GIT_DIR}refs/heads/$state->{module}";
1146
- print FILE $commithash;
1147
- close FILE;
1145
+ print LOCKFILE $commithash;
1146
1147
$updater->update();
1148
@@ -1171,7 +1169,9 @@ sub req_ci
1169
}
1170
1171
close LOCKFILE;
1174
- unlink($lockfile);
1172
+ my $reffile = "$ENV{GIT_DIR}refs/heads/$state->{module}";
1173
+ unlink($reffile);
1174
+ rename($lockfile, $reffile);
1175
chdir "/";
1176
1177
print "ok\n";