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>

Jeff King committed Jul 18, 2012 at 08:04 UTC 6319a2a148adaa78f11414e914f8c9f3f1c52b5e
1 file changed +1 -1
contrib/mw-to-git/git-remote-mediawiki
+1 -1
@@ -207,7 +207,7 @@ sub credential_write {
207 my $credential = shift;
208 my $writer = shift;
209 while (my ($key, $value) = each(%$credential) ) {
210 - if ($value) {
210 + if (length $value) {
211 print $writer "$key=$value\n";
212 }
213 }