@matheusbsbs / matheus-bagliano / commits / 5c08931dfc
Fork 0

Use git-tag in git-cvsimport

Currently git-cvsimport tries to create tag objects directly via git-mktag in a very broken way, e.g the stuff it writes into the tagger field of the tag object doesn't really resemble the GIT_COMMITTER_IDENT. This makes gitweb and possibly other tools that try to interpret tag objects to be confused about tag date and authorship. Fix this by calling git-tag instead. This also has a nice side effect of not creating the tag object but only the lightweight tag as that's the only thing CVS has anyways. Signed-off-by: Elvis Pranskevichus <el@prans.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elvis Pranskevichus committed Jun 3, 2007 at 02:56 UTC 5c08931dfc9fa0acbf8667581e4c98d643e66dbe
1 file changed +2 -24
git-cvsimport.perl
+2 -24
@@ -771,31 +771,9 @@ sub commit {
771 $xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY **
772 $xtag =~ tr/_/\./ if ( $opt_u );
773 $xtag =~ s/[\/]/$opt_s/g;
774 -
775 - my $pid = open2($in, $out, 'git-mktag');
776 - print $out "object $cid\n".
777 - "type commit\n".
778 - "tag $xtag\n".
779 - "tagger $author_name <$author_email>\n"
780 - or die "Cannot create tag object $xtag: $!\n";
781 - close($out)
782 - or die "Cannot create tag object $xtag: $!\n";
783 -
784 - my $tagobj = <$in>;
785 - chomp $tagobj;
786 -
787 - if ( !close($in) or waitpid($pid, 0) != $pid or
788 - $? != 0 or $tagobj !~ /^[0123456789abcdef]{40}$/ ) {
789 - die "Cannot create tag object $xtag: $!\n";
790 - }
791 -
792 -
793 - open(C,">$git_dir/refs/tags/$xtag")
774 +
775 + system('git-tag', $xtag, $cid) == 0
776 or die "Cannot create tag $xtag: $!\n";
795 - print C "$tagobj\n"
796 - or die "Cannot write tag $xtag: $!\n";
797 - close(C)
798 - or die "Cannot write tag $xtag: $!\n";
777
778 print "Created tag '$xtag' on '$branch'\n" if $opt_v;
779 }