Git fork

contrib: warn for invalid netrc file ports in git-credential-netrc

Invalid ports were previously silently dropped; now a warning message
is produced.

Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Maxim Cournoyer and committed by
Junio C Hamano
53ca3829 3570fba9

+8 -3
+8 -3
contrib/credential/netrc/git-credential-netrc.perl
··· 267 267 if (!defined $nentry->{machine}) { 268 268 next; 269 269 } 270 - if (defined $nentry->{port} && $nentry->{port} =~ m/^\d+$/) { 271 - $num_port = $nentry->{port}; 272 - delete $nentry->{port}; 270 + if (defined $nentry->{port}) { 271 + if ($nentry->{port} =~ m/^\d+$/) { 272 + $num_port = $nentry->{port}; 273 + delete $nentry->{port}; 274 + } else { 275 + printf(STDERR "ignoring invalid port `%s' " . 276 + "from netrc file\n", $nentry->{port}); 277 + } 273 278 } 274 279 275 280 # create the new entry for the credential helper protocol