Skip to content

Commit b28f5bc

Browse files
committed
Be more careful with valid but empty strings
1 parent c3e7b42 commit b28f5bc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils/credentials.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ int user_credentials(
1818
*out = nullptr;
1919

2020
if (allowed_types & GIT_CREDENTIAL_USERPASS_PLAINTEXT) {
21-
std::string username = username_from_url ? username_from_url : prompt_input("Username: ");
21+
std::string username = username_from_url ? username_from_url : "";
22+
if (username.empty()) {
23+
username = prompt_input("Username: ");
24+
}
2225
if (username.empty()) {
2326
giterr_set_str(GIT_ERROR_HTTP, "No username specified");
2427
return GIT_EAUTH;

0 commit comments

Comments
 (0)