[PATCH v4 2/4] git-credential-store: skip empty lines and comments from store
From: Carlo Marcelo Arenas Belón <hidden>
Date: 2020-04-28 10:53:15
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Carlo Marcelo Arenas Belón <hidden>
Date: 2020-04-28 10:53:15
Subsystem:
the rest · Maintainer:
Linus Torvalds
with the added checks for invalid URLs in credentials, any locally modified store files which might have empty lines or even comments were reported[1] failing to parse as valid credentials. add corresponding failing cases [1] https://stackoverflow.com/a/61420852/5005936 Reported-by: Dirk <redacted> Helped-by: Eric Sunshine [off-list ref] Signed-off-by: Carlo Marcelo Arenas Belón <redacted> --- t/t0302-credential-store.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh
index d6b54e8c65..94cdcb9e56 100755
--- a/t/t0302-credential-store.sh
+++ b/t/t0302-credential-store.sh@@ -120,4 +120,19 @@ test_expect_success 'erase: erase matching credentials from both xdg and home fi test_must_be_empty "$HOME/.config/git/credentials" ' +test_expect_failure 'get: store file can contain empty/bogus lines' ' + test_write_lines "#comment" " " "" \ + https://user:pass@example.com >"$HOME/.git-credentials" && + check fill store <<-\EOF + protocol=https + host=example.com + -- + protocol=https + host=example.com + username=user + password=pass + -- + EOF +' + test_done
--
2.26.2.569.g1d74ac4d14