Skip to content

Commit dc6dd55

Browse files
committed
Merge branch 'mc/cred-helper-ignore-unknown'
Most credential helpers ignored unknown entries in a credential description, but a few died upon seeing them. The latter were taught to ignore them, too * mc/cred-helper-ignore-unknown: osxkeychain: clarify that we ignore unknown lines netrc: ignore unknown lines (do not die) wincred: ignore unknown lines (do not die)
2 parents 20a5dd6 + 630a642 commit dc6dd55

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
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
}

contrib/credential/osxkeychain/git-credential-osxkeychain.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ static void read_credential(void)
159159
username = xstrdup(v);
160160
else if (!strcmp(buf, "password"))
161161
password = xstrdup(v);
162+
/*
163+
* Ignore other lines; we don't know what they mean, but
164+
* this future-proofs us when later versions of git do
165+
* learn new lines, and the helpers are updated to match.
166+
*/
162167
}
163168
}
164169

contrib/credential/wincred/git-credential-wincred.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,11 @@ static void read_credential(void)
278278
wusername = utf8_to_utf16_dup(v);
279279
} else if (!strcmp(buf, "password"))
280280
password = utf8_to_utf16_dup(v);
281-
else
282-
die("unrecognized input");
281+
/*
282+
* Ignore other lines; we don't know what they mean, but
283+
* this future-proofs us when later versions of git do
284+
* learn new lines, and the helpers are updated to match.
285+
*/
283286
}
284287
}
285288

0 commit comments

Comments
 (0)