File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use Moose::Util::TypeConstraints;
5
5
6
6
use Git::PurePerl::Protocol::Git;
7
7
use Git::PurePerl::Protocol::SSH;
8
+ use Git::PurePerl::Protocol::File;
8
9
9
10
has ' remote' => ( is => ' ro' , isa => ' Str' , required => 1 );
10
11
has ' read_socket' => ( is => ' rw' , required => 0 );
@@ -19,6 +20,11 @@ sub connect {
19
20
hostname => $2 ,
20
21
project => $3 ,
21
22
);
23
+ } elsif ($self -> remote =~ m { ^file://(/.*)} ) {
24
+ Git::PurePerl::Protocol::File-> meta-> rebless_instance(
25
+ $self ,
26
+ path => $1 ,
27
+ );
22
28
} elsif ($self -> remote =~ m { ^ssh://(?:(.*?)@)?(.*?)(/.*)}
23
29
or $self -> remote =~ m { ^(?:(.*?)@)?(.*?):(.*)} ) {
24
30
Git::PurePerl::Protocol::SSH-> meta-> rebless_instance(
Original file line number Diff line number Diff line change
1
+ package Git::PurePerl::Protocol::File ;
2
+ use Moose;
3
+ use MooseX::StrictConstructor;
4
+ use Moose::Util::TypeConstraints;
5
+ use IPC::Open2;
6
+
7
+ extends ' Git::PurePerl::Protocol' ;
8
+
9
+ has ' path' => ( is => ' ro' , isa => ' Str' , required => 1 );
10
+
11
+ sub connect_socket {
12
+ my $self = shift ;
13
+
14
+ my ($read , $write );
15
+ my $pid = open2(
16
+ $read , $write ,
17
+ " git-upload-pack" ,
18
+ $self -> path,
19
+ );
20
+
21
+ $read -> autoflush(1);
22
+ $write -> autoflush(1);
23
+ $self -> read_socket($read );
24
+ $self -> write_socket($write );
25
+ }
26
+
27
+ 1;
You can’t perform that action at this time.
0 commit comments