git-credential-netrc: fix uninitialized warning
authorTed Zlatanov <tzz@lifelogs.com>
Tue, 8 Oct 2013 20:02:02 +0000 (16:02 -0400)
committerJonathan Nieder <jrnieder@gmail.com>
Tue, 8 Oct 2013 20:56:36 +0000 (13:56 -0700)
Simple patch to avoid unitialized warning and log what we'll do.

Signed-off-by: Ted Zlatanov <tzz@lifelogs.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
contrib/credential/netrc/git-credential-netrc
index 6c51c438858e8ac34c5c75c72fbd5cb7a4defd9d..1571a7b2693e50ac93828a76a01366da1e8a6983 100755 (executable)
@@ -369,7 +369,9 @@ sub find_netrc_entry {
        {
                my $entry_text = join ', ', map { "$_=$entry->{$_}" } keys %$entry;
                foreach my $check (sort keys %$query) {
-                       if (defined $query->{$check}) {
+                       if (!defined $entry->{$check}) {
+                               log_debug("OK: entry has no $check token, so any value satisfies check $check");
+                       } elsif (defined $query->{$check}) {
                                log_debug("compare %s [%s] to [%s] (entry: %s)",
                                          $check,
                                          $entry->{$check},