Skip to content

Commit 6ea87d9

Browse files
mjcheethamgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d695804 commit 6ea87d9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contrib/credential/netrc/git-credential-netrc.perl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,10 @@ sub read_credential_data_from_stdin {
356356
next unless m/^([^=]+)=(.+)/;
357357

358358
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+
360363
$q{$token} = $value;
361364
log_debug("We were given search token $token and value $value");
362365
}

0 commit comments

Comments
 (0)