From: Jeff King Date: Wed, 18 Jul 2012 12:04:30 +0000 (-0400) Subject: mw-to-git: check blank credential attributes via length X-Git-Tag: v1.7.12-rc0~7^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6319a2a148adaa78f11414e914f8c9f3f1c52b5e;p=git.git 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 Acked-by: Matthieu Moy Signed-off-by: Junio C Hamano --- diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki index accd70a94..b06f27b92 100755 --- a/contrib/mw-to-git/git-remote-mediawiki +++ b/contrib/mw-to-git/git-remote-mediawiki @@ -207,7 +207,7 @@ sub credential_write { my $credential = shift; my $writer = shift; while (my ($key, $value) = each(%$credential) ) { - if ($value) { + if (length $value) { print $writer "$key=$value\n"; } }