netrc: ignore unknown lines (do not die)

Contrary to the documentation on credential helpers, as well as the help text for git-credential-netrc itself, this helper will `die` when presented with an unknown property/attribute/token. Correct the behaviour here by skipping and ignoring any tokens that are unknown. This means all helpers in the tree are consistent and ignore any unknown credential properties/attributes. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthew John Cheetham committed Sep 22, 2022 at 16:59 UTC 6ea87d97af30c25ce48b524943ec9493bd5e51ca
1 file changed +4 -1
contrib/credential/netrc/git-credential-netrc.perl
+4 -1
@@ -356,7 +356,10 @@ sub read_credential_data_from_stdin {
356 next unless m/^([^=]+)=(.+)/;
357
358 my ($token, $value) = ($1, $2);
359 - die "Unknown search token $token" unless exists $q{$token};
359 +
360 + # skip any unknown tokens
361 + next unless exists $q{$token};
362 +
363 $q{$token} = $value;
364 log_debug("We were given search token $token and value $value");
365 }