Skip to content

Commit d5c2419

Browse files
committed
Remove extra output after switching to different branch
1 parent 162a89a commit d5c2419

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/subcommand/checkout_subcommand.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ void checkout_subcommand::run()
150150
update_head(repo, annotated_commit, target_name);
151151

152152
std::cout << "Switched to a new branch '" << target_name << "'" << std::endl;
153+
return;
153154
}
154155
else if (!pathspecs.empty())
155156
{

‎test/test_checkout.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def test_checkout_b(repo_init_with_commit, git2cpp_path, tmp_path):
3535
p_checkout = subprocess.run(checkout_cmd, capture_output=True, cwd=tmp_path, text=True)
3636
assert p_checkout.returncode == 0
3737
assert "Switched to a new branch 'foregone'" in p_checkout.stdout
38+
assert "Switched to branch 'foregone'" not in p_checkout.stdout
3839

3940
branch_cmd = [git2cpp_path, "branch"]
4041
p_branch = subprocess.run(branch_cmd, capture_output=True, cwd=tmp_path, text=True)
@@ -65,6 +66,7 @@ def test_checkout_B_force_create(repo_init_with_commit, git2cpp_path, tmp_path):
6566
p_checkout = subprocess.run(checkout_cmd, capture_output=True, cwd=tmp_path, text=True)
6667
assert p_checkout.returncode == 0
6768
assert "Switched to a new branch 'resetme'" in p_checkout.stdout
69+
assert "Switched to branch 'resetme'" not in p_checkout.stdout
6870

6971
# Verify we're on the branch
7072
branch_cmd = [git2cpp_path, "branch"]

0 commit comments

Comments
 (0)