From: Junio C Hamano Date: Wed, 24 Oct 2007 11:49:51 +0000 (-0700) Subject: git-remote: fix "Use of uninitialized value in string ne" X-Git-Tag: v1.5.3.5~17 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=59b2023fbb154bc4671782955daddf8ef3018c93;p=git.git git-remote: fix "Use of uninitialized value in string ne" martin f krafft 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..remote defined but the code unconditionally dereferences $branch->{$name}{'REMOTE'} and compares with another string. Tested-by: Martin F Krafft Signed-off-by: Junio C Hamano --- diff --git a/git-remote.perl b/git-remote.perl index 8e2dc4de7..11630b1a8 100755 --- a/git-remote.perl +++ b/git-remote.perl @@ -244,7 +244,8 @@ sub show_remote { print "* remote $name\n"; print " URL: $info->{'URL'}\n"; for my $branchname (sort keys %$branch) { - next if ($branch->{$branchname}{'REMOTE'} ne $name); + next unless (defined $branch->{$branchname}{'REMOTE'} && + $branch->{$branchname}{'REMOTE'} eq $name); my @merged = map { s|^refs/heads/||; $_;