@matheusbsbs / matheus-bagliano / commits / 47ee8ed292
Fork 0

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 <gitster@pobox.com>

Dave O'Neill committed Jun 21, 2007 at 17:48 UTC 47ee8ed292f14e819d8e449a56c2de02d1892483
2 files changed +3 -24
git-cvsimport.perl
-1
@@ -774,7 +774,6 @@ sub commit {
774 or die "Cannot write branch $branch for update: $!\n";
775
776 if ($tag) {
777 - my ($in, $out) = ('','');
777 my ($xtag) = $tag;
778 $xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY **
779 $xtag =~ tr/_/\./ if ( $opt_u );
git-svnimport.perl
+3 -23
@@ -867,34 +867,14 @@ sub commit {
867 or die "Cannot write branch $dest for update: $!\n";
868 }
869
870 - if($tag) {
871 - my($in, $out) = ('','');
870 + if ($tag) {
871 $last_rev = "-" if %$changed_paths;
872 # the tag was 'complex', i.e. did not refer to a "real" revision
873
874 $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 - }
875
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";
878
879 print "Created tag '$dest' on '$branch'\n" if $opt_v;
880 }