@matheusbsbs / matheus-bagliano / commits / 59b2023fbb
Fork 0

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>

Junio C Hamano committed Oct 24, 2007 at 04:49 UTC 59b2023fbb154bc4671782955daddf8ef3018c93
1 file changed +2 -1
git-remote.perl
+2 -1
@@ -244,7 +244,8 @@ sub show_remote {
244 print "* remote $name\n";
245 print " URL: $info->{'URL'}\n";
246 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);
249 my @merged = map {
250 s|^refs/heads/||;
251 $_;