svn import: Fix tagging.
Tagging was 100% broken. :-/ Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
Matthias Urlichs committed
Oct 10, 2005 at 14:42 UTC
f02b3eba7fc6e3fca25e0063dde6ff149aed2b45
1 file changed
+12
-16
git-svnimport.perl
+12
-16
@@ -122,8 +122,7 @@ sub file {
122
DIR => File::Spec->tmpdir(), UNLINK => 1);
123
124
print "... $rev $path ...\n" if $opt_v;
125
- my $s = $self->{'svn'};
126
- eval { $s->get_file($path,$rev,$fh); };
125
+ eval { $self->{'svn'}->get_file($path,$rev,$fh); };
126
if ($@ and $@ !~ /Attempted to get checksum/) {
127
# retry
128
$self->conn();
@@ -544,14 +543,14 @@ sub commit {
543
waitpid($pid,0);
544
die "Error running git-commit-tree: $?\n" if $?;
545
547
- if(defined $dest) {
546
+ if(not defined $dest) {
547
+ print "... no known parent\n" if $opt_v;
548
+ } elsif(not $tag) {
549
print "Writing to refs/heads/$dest\n" if $opt_v;
550
open(C,">$git_dir/refs/heads/$dest") and
551
print C ("$cid\n") and
552
close(C)
553
or die "Cannot write branch $dest for update: $!\n";
553
- } else {
554
- print "... no known parent\n" if $opt_v;
554
}
555
$branches{$branch}{"LAST"} = $cid;
556
$branches{$branch}{$revision} = $cid;
@@ -564,33 +563,30 @@ sub commit {
563
$last_rev = "-" if %$changed_paths;
564
# the tag was 'complex', i.e. did not refer to a "real" revision
565
567
- $tag =~ tr/_/\./ if $opt_u;
566
+ $dest =~ tr/_/\./ if $opt_u;
567
568
my $pid = open2($in, $out, 'git-mktag');
569
print $out ("object $cid\n".
570
"type commit\n".
572
- "tag $tag\n".
571
+ "tag $dest\n".
572
"tagger $author_name <$author_email>\n") and
573
close($out)
575
- or die "Cannot create tag object $tag: $!\n";
574
+ or die "Cannot create tag object $dest: $!\n";
575
576
my $tagobj = <$in>;
577
chomp $tagobj;
578
579
if ( !close($in) or waitpid($pid, 0) != $pid or
580
$? != 0 or $tagobj !~ /^[0123456789abcdef]{40}$/ ) {
582
- die "Cannot create tag object $tag: $!\n";
581
+ die "Cannot create tag object $dest: $!\n";
582
}
584
-
583
586
- open(C,">$git_dir/refs/tags/$tag")
587
- or die "Cannot create tag $tag: $!\n";
588
- print C "$tagobj\n"
589
- or die "Cannot write tag $tag: $!\n";
584
+ open(C,">$git_dir/refs/tags/$dest") and
585
+ print C ("$tagobj\n") and
586
close(C)
591
- or die "Cannot write tag $tag: $!\n";
587
+ or die "Cannot create tag $branch: $!\n";
588
593
- print "Created tag '$tag' on '$branch'\n" if $opt_v;
589
+ print "Created tag '$dest' on '$branch'\n" if $opt_v;
590
}
591
}
592