Code

cvsimport: use git-update-ref when updating
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Thu, 30 Mar 2006 12:06:15 +0000 (14:06 +0200)
committerJunio C Hamano <junkio@cox.net>
Wed, 5 Apr 2006 00:13:25 +0000 (17:13 -0700)
This simplifies code, and also fixes a subtle bug: when importing in a
shared repository, where another user last imported from CVS, cvsimport
used to complain that it could not open <branch> for update.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-cvsimport.perl

index 3728294e740b466b97f623302ddd89fab1ba0e92..c0ae00bda74e68f98efc63c093efb73c7ff914f4 100755 (executable)
@@ -677,11 +677,7 @@ my $commit = sub {
        waitpid($pid,0);
        die "Error running git-commit-tree: $?\n" if $?;
 
-       open(C,">$git_dir/refs/heads/$branch")
-               or die "Cannot open branch $branch for update: $!\n";
-       print C "$cid\n"
-               or die "Cannot write branch $branch for update: $!\n";
-       close(C)
+       system("git-update-ref refs/heads/$branch $cid") == 0
                or die "Cannot write branch $branch for update: $!\n";
 
        if($tag) {