mw-to-git: check blank credential attributes via length
When writing a credential to git-credential, we omit fields that do not have a true value. This will skip empty or undefined fields (which we want), but will also accidentally skip usernames or passwords which happen to have a non-true value (e.g., "0"). Be more careful by checking for non-zero length. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
3e5f29e896
commit
6319a2a148
@ -207,7 +207,7 @@ sub credential_write {
|
|||||||
my $credential = shift;
|
my $credential = shift;
|
||||||
my $writer = shift;
|
my $writer = shift;
|
||||||
while (my ($key, $value) = each(%$credential) ) {
|
while (my ($key, $value) = each(%$credential) ) {
|
||||||
if ($value) {
|
if (length $value) {
|
||||||
print $writer "$key=$value\n";
|
print $writer "$key=$value\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user