Skip to content

Commit 59b2023

Browse files
committed
git-remote: fix "Use of uninitialized value in string ne"
martin f krafft <madduck@madduck.net> writes: > piper:~> git remote show origin > * remote origin > URL: ssh://git.madduck.net/~/git/etc/mailplate.git > Use of uninitialized value in string ne at /usr/local/stow/git/bin/git-remote line 248. This is because there might not be branch.<name>.remote defined but the code unconditionally dereferences $branch->{$name}{'REMOTE'} and compares with another string. Tested-by: Martin F Krafft <madduck@madduck.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2ee52eb commit 59b2023

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git-remote.perl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ sub show_remote {
244244
print "* remote $name\n";
245245
print " URL: $info->{'URL'}\n";
246246
for my $branchname (sort keys %$branch) {
247-
next if ($branch->{$branchname}{'REMOTE'} ne $name);
247+
next unless (defined $branch->{$branchname}{'REMOTE'} &&
248+
$branch->{$branchname}{'REMOTE'} eq $name);
248249
my @merged = map {
249250
s|^refs/heads/||;
250251
$_;

0 commit comments

Comments
 (0)