credential/wincred: erase matching creds only
commitcb626f8e5cb76ce081ab0a02656611f05a54cfb5
authorM Hickford <mirth.hickford@gmail.com>
Wed, 26 Jul 2023 19:51:22 +0000 (26 19:51 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Jul 2023 20:27:34 +0000 (26 13:27 -0700)
tree34001e4616c7d3d6cd15067572ff0564fb1ccf50
parent7144dee3ec233674ba534797e41fa399708c8313
credential/wincred: erase matching creds only

The credential erase request typically includes protocol, host, username
and password.

credential-wincred erases stored credentials that match protocol,
host and username, regardless of password.

This is confusing in the case the stored password differs from that
in the request. This case can occur when multiple credential helpers are
configured.

Only erase credential if stored password matches request (or request
omits password).

This fixes test "helper (wincred) does not erase a password distinct
from input" when t0303 is run with GIT_TEST_CREDENTIAL_HELPER set to
"wincred". This test was added in aeb21ce22e (credential: avoid
erasing distinct password, 2023-06-13).

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/credential/wincred/git-credential-wincred.c