diff options
author | M Hickford <mirth.hickford@gmail.com> | 2024-02-19 20:40:58 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-19 14:36:35 -0800 |
commit | 8f1f2023b758179b31188b665496b514dbb952d6 (patch) | |
tree | 3f6bdb911bcf5a1e38462324eb6febfbaea324f1 /contrib | |
parent | dadef801b365989099a9929e995589e455c51fed (diff) | |
download | git-8f1f2023b758179b31188b665496b514dbb952d6.tar.gz |
libsecret: retrieve empty password
Since 0ce02e2f (credential/libsecret: store new attributes, 2023-06-16)
a test that stores empty username and password fails when
t0303-credential-external.sh is run with
GIT_TEST_CREDENTIAL_HELPER=libsecret.
Retrieve empty password carefully. This fixes test:
ok 14 - helper (libsecret) can store empty username
Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/credential/libsecret/git-credential-libsecret.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c index 215a81d8ba..90034d0cf1 100644 --- a/contrib/credential/libsecret/git-credential-libsecret.c +++ b/contrib/credential/libsecret/git-credential-libsecret.c @@ -164,6 +164,9 @@ static int keyring_get(struct credential *c) if (g_strv_length(parts) >= 1) { g_free(c->password); c->password = g_strdup(parts[0]); + } else { + g_free(c->password); + c->password = g_strdup(""); } for (int i = 1; i < g_strv_length(parts); i++) { if (g_str_has_prefix(parts[i], "password_expiry_utc=")) { |