Skip to content

Commit 7752c8a

Browse files
committed
address review comments
1 parent d698b28 commit 7752c8a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/subcommand/config_subcommand.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ void config_subcommand::run_get()
5656
{
5757
if (m_name.empty())
5858
{
59-
std::cout << "error: wrong number of arguments, should be 1" << std::endl;
60-
return;
59+
throw git_exception("error: wrong number of arguments, should be 1", 129);
6160
}
6261

6362
auto directory = get_current_git_path();
@@ -74,8 +73,7 @@ void config_subcommand::run_set()
7473
{
7574
if (m_name.empty() | m_value.empty())
7675
{
77-
std::cout << "error: wrong number of arguments, should be 2" << std::endl;
78-
return;
76+
throw git_exception("error: wrong number of arguments, should be 2", 129);
7977
}
8078

8179
auto directory = get_current_git_path();
@@ -89,8 +87,7 @@ void config_subcommand::run_unset()
8987
{
9088
if (m_name.empty())
9189
{
92-
std::cout << "error: wrong number of arguments, should be 1" << std::endl;
93-
return;
90+
throw git_exception("error: wrong number of arguments, should be 1", 129);
9491
}
9592

9693
auto directory = get_current_git_path();

test/test_config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55

6-
def test_config_list(commit_env_config, git2cpp_path, tmp_path, monkeypatch):
6+
def test_config_list(commit_env_config, git2cpp_path, tmp_path):
77
cmd_init = [git2cpp_path, "init", "--bare", str(tmp_path)]
88
p_init = subprocess.run(cmd_init, capture_output=True)
99
assert p_init.returncode == 0
@@ -23,11 +23,10 @@ def test_config_get(git2cpp_path, tmp_path):
2323
cmd_get = [git2cpp_path, "config", "get", "core.bare"]
2424
p_get = subprocess.run(cmd_get, capture_output=True, cwd=tmp_path, text=True)
2525
assert p_get.returncode == 0
26-
print(p_get.stdout)
2726
assert p_get.stdout == "true\n"
2827

2928

30-
def test_config_set(commit_env_config, git2cpp_path, tmp_path, monkeypatch):
29+
def test_config_set(commit_env_config, git2cpp_path, tmp_path):
3130
cmd_init = [git2cpp_path, "init", "--bare", str(tmp_path)]
3231
p_init = subprocess.run(cmd_init, capture_output=True)
3332
assert p_init.returncode == 0

0 commit comments

Comments
 (0)