Skip to content

Commit 8b84623

Browse files
committed
Fix Git->remote($arg) so it won't error if the remote does not exist.
1 parent d2ffe1e commit 8b84623

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/Gitpan/Git.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ method remotes() {
193193

194194
method remote( Str $name, Str $action = "push" ) {
195195
my $remote = $self->remotes->{$name};
196+
return unless $remote;
196197
return $action eq "push" ? $remote->pushurl || $remote->url : $remote->url;
197198
}
198199

t/Git.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ note "Remotes"; {
103103
);
104104

105105
is_deeply $git->remotes, {};
106+
107+
ok !$git->remote("foo");
108+
106109
$git->change_remote( foo => "http://example.com" );
107110

108111
is $git->remote( "foo" ), "http://example.com";

0 commit comments

Comments
 (0)