Skip to content

Commit 47ee8ed

Browse files
Dave O'Neillgitster
authored andcommitted
Generate tags with correct timestamp (git-svnimport)
Now uses git-tag instead of manually constructing the tag. This gives us a correct timestamp, removes some crufty code, and makes it work the same as git-cvsimport. The generated tags are now lightweight tags instead of tag objects, which may or may not be the behaviour we want. Also, remove two unused variables from git-cvsimport. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6762079 commit 47ee8ed

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

git-cvsimport.perl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ sub commit {
774774
or die "Cannot write branch $branch for update: $!\n";
775775

776776
if ($tag) {
777-
my ($in, $out) = ('','');
778777
my ($xtag) = $tag;
779778
$xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY **
780779
$xtag =~ tr/_/\./ if ( $opt_u );

git-svnimport.perl

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -867,34 +867,14 @@ sub commit {
867867
or die "Cannot write branch $dest for update: $!\n";
868868
}
869869

870-
if($tag) {
871-
my($in, $out) = ('','');
870+
if ($tag) {
872871
$last_rev = "-" if %$changed_paths;
873872
# the tag was 'complex', i.e. did not refer to a "real" revision
874873

875874
$dest =~ tr/_/\./ if $opt_u;
876-
$branch = $dest;
877-
878-
my $pid = open2($in, $out, 'git-mktag');
879-
print $out ("object $cid\n".
880-
"type commit\n".
881-
"tag $dest\n".
882-
"tagger $committer_name <$committer_email> 0 +0000\n") and
883-
close($out)
884-
or die "Cannot create tag object $dest: $!\n";
885-
886-
my $tagobj = <$in>;
887-
chomp $tagobj;
888-
889-
if ( !close($in) or waitpid($pid, 0) != $pid or
890-
$? != 0 or $tagobj !~ /^[0123456789abcdef]{40}$/ ) {
891-
die "Cannot create tag object $dest: $!\n";
892-
}
893875

894-
open(C,">$git_dir/refs/tags/$dest") and
895-
print C ("$tagobj\n") and
896-
close(C)
897-
or die "Cannot create tag $branch: $!\n";
876+
system('git-tag', $dest, $cid) == 0
877+
or die "Cannot create tag $dest: $!\n";
898878

899879
print "Created tag '$dest' on '$branch'\n" if $opt_v;
900880
}

0 commit comments

Comments
 (0)