Skip to content

Commit 10c2aa5

Browse files
schwernEric Wong
authored andcommitted
Move Git::IndexInfo into its own file.
Straight cut & paste. Didn't require any fixing. Signed-off-by: Eric Wong <normalperson@yhbt.net>
1 parent e96cdba commit 10c2aa5

File tree

5 files changed

+37
-33
lines changed

5 files changed

+37
-33
lines changed

git-svn.perl

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,38 +2040,6 @@ sub gc_directory {
20402040
}
20412041

20422042

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-
20752043
package Git::SVN::GlobSpec;
20762044
use strict;
20772045
use warnings;

perl/Git/IndexInfo.pm

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ sub new {
5757
$self->{file_prop} = {};
5858
$self->{absent_dir} = {};
5959
$self->{absent_file} = {};
60+
require Git::IndexInfo;
6061
$self->{gii} = $git_svn->tmp_index_do(sub { Git::IndexInfo->new });
6162
$self->{pathnameencoding} = Git::config('svn.pathnameencoding');
6263
$self;

perl/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ instdir_SQ = $(subst ','\'',$(prefix)/lib)
2929

3030
modules += Git
3131
modules += Git/I18N
32+
modules += Git/IndexInfo
3233
modules += Git/SVN
3334
modules += Git/SVN/Memoize/YAML
3435
modules += Git/SVN/Fetcher

t/Git-SVN/00compile.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
use strict;
44
use warnings;
55

6-
use Test::More tests => 5;
6+
use Test::More tests => 6;
77

88
require_ok 'Git::SVN';
99
require_ok 'Git::SVN::Utils';
1010
require_ok 'Git::SVN::Ra';
1111
require_ok 'Git::SVN::Log';
1212
require_ok 'Git::SVN::Migration';
13+
require_ok 'Git::IndexInfo';

0 commit comments

Comments
 (0)