Move Git::IndexInfo into its own file.
Straight cut & paste. Didn't require any fixing. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Michael G. Schwern committed
Jul 26, 2012 at 17:26 UTC
10c2aa5928b5309374bb4328f1c2849cb4ae65cc
5 files changed
+37
-33
git-svn.perl
-32
@@ -2040,38 +2040,6 @@ sub gc_directory {
2040
}
2041
2042
2043
-package Git::IndexInfo;
2044
-use strict;
2045
-use warnings;
2046
-use Git qw/command_input_pipe command_close_pipe/;
2047
-
2048
-sub new {
2049
- my ($class) = @_;
2050
- my ($gui, $ctx) = command_input_pipe(qw/update-index -z --index-info/);
2051
- bless { gui => $gui, ctx => $ctx, nr => 0}, $class;
2052
-}
2053
-
2054
-sub remove {
2055
- my ($self, $path) = @_;
2056
- if (print { $self->{gui} } '0 ', 0 x 40, "\t", $path, "\0") {
2057
- return ++$self->{nr};
2058
- }
2059
- undef;
2060
-}
2061
-
2062
-sub update {
2063
- my ($self, $mode, $hash, $path) = @_;
2064
- if (print { $self->{gui} } $mode, ' ', $hash, "\t", $path, "\0") {
2065
- return ++$self->{nr};
2066
- }
2067
- undef;
2068
-}
2069
-
2070
-sub DESTROY {
2071
- my ($self) = @_;
2072
- command_close_pipe($self->{gui}, $self->{ctx});
2073
-}
2074
-
2043
package Git::SVN::GlobSpec;
2044
use strict;
2045
use warnings;
perl/Git/IndexInfo.pm
new
+33
@@ -0,0 +1,33 @@
1
+package Git::IndexInfo;
2
+use strict;
3
+use warnings;
4
+use Git qw/command_input_pipe command_close_pipe/;
5
+
6
+sub new {
7
+ my ($class) = @_;
8
+ my ($gui, $ctx) = command_input_pipe(qw/update-index -z --index-info/);
9
+ bless { gui => $gui, ctx => $ctx, nr => 0}, $class;
10
+}
11
+
12
+sub remove {
13
+ my ($self, $path) = @_;
14
+ if (print { $self->{gui} } '0 ', 0 x 40, "\t", $path, "\0") {
15
+ return ++$self->{nr};
16
+ }
17
+ undef;
18
+}
19
+
20
+sub update {
21
+ my ($self, $mode, $hash, $path) = @_;
22
+ if (print { $self->{gui} } $mode, ' ', $hash, "\t", $path, "\0") {
23
+ return ++$self->{nr};
24
+ }
25
+ undef;
26
+}
27
+
28
+sub DESTROY {
29
+ my ($self) = @_;
30
+ command_close_pipe($self->{gui}, $self->{ctx});
31
+}
32
+
33
+1;
perl/Git/SVN/Fetcher.pm
+1
@@ -57,6 +57,7 @@ sub new {
57
$self->{file_prop} = {};
58
$self->{absent_dir} = {};
59
$self->{absent_file} = {};
60
+ require Git::IndexInfo;
61
$self->{gii} = $git_svn->tmp_index_do(sub { Git::IndexInfo->new });
62
$self->{pathnameencoding} = Git::config('svn.pathnameencoding');
63
$self;
perl/Makefile
+1
@@ -29,6 +29,7 @@ instdir_SQ = $(subst ','\'',$(prefix)/lib)
29
30
modules += Git
31
modules += Git/I18N
32
+modules += Git/IndexInfo
33
modules += Git/SVN
34
modules += Git/SVN/Memoize/YAML
35
modules += Git/SVN/Fetcher
t/Git-SVN/00compile.t
+2
-1
@@ -3,10 +3,11 @@
3
use strict;
4
use warnings;
5
6
-use Test::More tests => 5;
6
+use Test::More tests => 6;
7
8
require_ok 'Git::SVN';
9
require_ok 'Git::SVN::Utils';
10
require_ok 'Git::SVN::Ra';
11
require_ok 'Git::SVN::Log';
12
require_ok 'Git::SVN::Migration';
13
+require_ok 'Git::IndexInfo';