Skip to content

Commit 9090fec

Browse files
committed
debug CI
1 parent 5edcb7e commit 9090fec

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/utils/credentials.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int user_credentials(
3232

3333
std::string password = prompt_input("Password: ", false);
3434

35-
std::cout << "YYYY password " << username.size() << " " << " YYYY" << std::endl;
35+
std::cout << "YYYY password " << password.size() << " " << " YYYY" << std::endl;
3636

3737
if (password.empty()) {
3838
giterr_set_str(GIT_ERROR_HTTP, "No password specified");

test/test_clone.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,14 @@ def test_clone_private_repo(git2cpp_path, tmp_path, run_in_tmp_path, private_tes
5555
repo_path = tmp_path / private_test_repo['repo_name']
5656
url = private_test_repo['https_url' if protocol == 'https' else 'http_url']
5757

58-
clone_cmd = [git2cpp_path.str(), "clone", url]
59-
p_clone = subprocess.run(" ".join(clone_cmd), capture_output=True, text=True, input=input, shell=True)
58+
clone_cmd = [git2cpp_path, "clone", url]
59+
#p_clone = subprocess.run(clone_cmd, capture_output=True, text=True, input=input)
60+
p_clone = subprocess.Popen(clone_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
61+
stderr=subprocess.PIPE, text=True)
62+
p_clone.stdout, p_clone.stderr = p_clone.communicate(input)
63+
64+
65+
6066
assert p_clone.returncode == 0
6167
assert repo_path.exists()
6268
# Single request for username and password.
@@ -79,8 +85,8 @@ def test_clone_private_repo_fails_then_succeeds(
7985
input = "\n".join(["wrong1", "wrong2", username, password])
8086
repo_path = tmp_path / private_test_repo['repo_name']
8187

82-
clone_cmd = [git2cpp_path.str(), "clone", private_test_repo['https_url']]
83-
p_clone = subprocess.run(" ".join(clone_cmd), capture_output=True, text=True, input=input, shell=True)
88+
clone_cmd = [git2cpp_path, "clone", private_test_repo['https_url']]
89+
p_clone = subprocess.run(clone_cmd, capture_output=True, text=True, input=input)
8490
assert p_clone.returncode == 0
8591
assert repo_path.exists()
8692
# Two requests for username and password.
@@ -100,8 +106,8 @@ def test_clone_private_repo_fails_on_no_username(
100106
input = ""
101107
repo_path = tmp_path / private_test_repo['repo_name']
102108

103-
clone_cmd = [git2cpp_path.str(), "clone", private_test_repo['https_url']]
104-
p_clone = subprocess.run(" ".join(clone_cmd), capture_output=True, text=True, input=input, shell=True)
109+
clone_cmd = [git2cpp_path, "clone", private_test_repo['https_url']]
110+
p_clone = subprocess.run(clone_cmd, capture_output=True, text=True, input=input)
105111

106112
assert p_clone.returncode != 0
107113
assert "No username specified" in p_clone.stderr
@@ -116,8 +122,8 @@ def test_clone_private_repo_fails_on_no_password(
116122
input = "username\n" # Note no password after the \n
117123
repo_path = tmp_path / private_test_repo['repo_name']
118124

119-
clone_cmd = [git2cpp_path.str(), "clone", private_test_repo['https_url']]
120-
p_clone = subprocess.run(" ".join(clone_cmd), capture_output=True, text=True, input=input, shell=True)
125+
clone_cmd = [git2cpp_path, "clone", private_test_repo['https_url']]
126+
p_clone = subprocess.run(clone_cmd, capture_output=True, text=True, input=input)
121127

122128
assert p_clone.returncode != 0
123129
assert "No password specified" in p_clone.stderr

0 commit comments

Comments
 (0)