git-svn: Remove unnecessary Git::SVN::Util package
Digest::MD5 is loaded regardless of the package in which it's declared, so move its 'use' statement and the md5sum() function into the main package. Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net> Acked-by: Eric Wong <normalperson@yhbt.net>
David D. Kilzer committed
Nov 22, 2007 at 11:18 UTC
8d7c4fad3ff6b3f675568adab9ddf77e9fcf8b8a
1 file changed
+9
-14
git-svn.perl
+9
-14
@@ -35,6 +35,7 @@ push @Git::SVN::Ra::ISA, 'SVN::Ra';
35
push @SVN::Git::Editor::ISA, 'SVN::Delta::Editor';
36
push @SVN::Git::Fetcher::ISA, 'SVN::Delta::Editor';
37
use Carp qw/croak/;
38
+use Digest::MD5;
39
use IO::File qw//;
40
use File::Basename qw/dirname basename/;
41
use File::Path qw/mkpath/;
@@ -48,8 +49,7 @@ BEGIN {
49
foreach (qw/command command_oneline command_noisy command_output_pipe
50
command_input_pipe command_close_pipe/) {
51
for my $package ( qw(SVN::Git::Editor SVN::Git::Fetcher
51
- Git::SVN::Migration Git::SVN::Log Git::SVN
52
- Git::SVN::Util),
52
+ Git::SVN::Migration Git::SVN::Log Git::SVN),
53
__PACKAGE__) {
54
*{"${package}::$_"} = \&{"Git::$_"};
55
}
@@ -842,19 +842,19 @@ sub cmd_info {
842
command_output_pipe(qw(cat-file blob), "HEAD:$path");
843
if ($file_type eq "link") {
844
my $file_name = <$fh>;
845
- $checksum = Git::SVN::Util::md5sum("link $file_name");
845
+ $checksum = md5sum("link $file_name");
846
} else {
847
- $checksum = Git::SVN::Util::md5sum($fh);
847
+ $checksum = md5sum($fh);
848
}
849
command_close_pipe($fh, $ctx);
850
} elsif ($file_type eq "link") {
851
my $file_name =
852
command(qw(cat-file blob), "HEAD:$path");
853
$checksum =
854
- Git::SVN::Util::md5sum("link " . $file_name);
854
+ md5sum("link " . $file_name);
855
} else {
856
open FILE, "<", $path or die $!;
857
- $checksum = Git::SVN::Util::md5sum(\*FILE);
857
+ $checksum = md5sum(\*FILE);
858
close FILE or die $!;
859
}
860
$result .= "Checksum: " . $checksum . "\n";
@@ -1195,11 +1195,6 @@ sub find_file_type_and_diff_status {
1195
return ("file", $diff_status);
1196
}
1197
1198
-package Git::SVN::Util;
1199
-use strict;
1200
-use warnings;
1201
-use Digest::MD5;
1202
-
1198
sub md5sum {
1199
my $arg = shift;
1200
my $ref = ref $arg;
@@ -2971,7 +2966,7 @@ sub apply_textdelta {
2966
2967
if (defined $exp) {
2968
seek $base, 0, 0 or croak $!;
2974
- my $got = Git::SVN::Util::md5sum($base);
2969
+ my $got = ::md5sum($base);
2970
die "Checksum mismatch: $fb->{path} $fb->{blob}\n",
2971
"expected: $exp\n",
2972
" got: $got\n" if ($got ne $exp);
@@ -2990,7 +2985,7 @@ sub close_file {
2985
if (my $fh = $fb->{fh}) {
2986
if (defined $exp) {
2987
seek($fh, 0, 0) or croak $!;
2993
- my $got = Git::SVN::Util::md5sum($fh);
2988
+ my $got = ::md5sum($fh);
2989
if ($got ne $exp) {
2990
die "Checksum mismatch: $path\n",
2991
"expected: $exp\n got: $got\n";
@@ -3345,7 +3340,7 @@ sub chg_file {
3340
$fh->flush == 0 or croak $!;
3341
seek $fh, 0, 0 or croak $!;
3342
3348
- my $exp = Git::SVN::Util::md5sum($fh);
3343
+ my $exp = ::md5sum($fh);
3344
seek $fh, 0, 0 or croak $!;
3345
3346
my $pool = SVN::Pool->new;