diff options
| author | Matthew John Cheetham <mjcheetham@outlook.com> | 2022-09-22 16:59:33 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-09-22 14:20:59 -0700 |
| commit | 6ea87d97af30c25ce48b524943ec9493bd5e51ca (patch) | |
| tree | 2ac9d8f278756de524368d63a6111775a88a31f4 /contrib/credential/netrc/git-credential-netrc.perl | |
| parent | wincred: ignore unknown lines (do not die) (diff) | |
| download | git-6ea87d97af30c25ce48b524943ec9493bd5e51ca.tar.gz git-6ea87d97af30c25ce48b524943ec9493bd5e51ca.zip | |
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>
Diffstat (limited to 'contrib/credential/netrc/git-credential-netrc.perl')
| -rwxr-xr-x | contrib/credential/netrc/git-credential-netrc.perl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/credential/netrc/git-credential-netrc.perl b/contrib/credential/netrc/git-credential-netrc.perl index bc57cc6588..9fb998ae09 100755 --- a/contrib/credential/netrc/git-credential-netrc.perl +++ b/contrib/credential/netrc/git-credential-netrc.perl @@ -356,7 +356,10 @@ sub read_credential_data_from_stdin { next unless m/^([^=]+)=(.+)/; my ($token, $value) = ($1, $2); - die "Unknown search token $token" unless exists $q{$token}; + + # skip any unknown tokens + next unless exists $q{$token}; + $q{$token} = $value; log_debug("We were given search token $token and value $value"); } |
