cli: show stats if multiple branches are tracked/untracked

Just like the other branch commands.
This commit is contained in:
Yuya Nishihara 2023-10-21 07:09:29 +09:00
parent d7f504c98c
commit baef7f1da2
2 changed files with 17 additions and 1 deletions

View file

@ -496,6 +496,13 @@ fn cmd_branch_track(
.track_remote_branch(&name.branch, &name.remote);
}
tx.finish(ui)?;
if names.len() > 1 {
writeln!(
ui.stderr(),
"Started tracking {} remote branches.",
names.len()
)?;
}
Ok(())
}
@ -527,6 +534,13 @@ fn cmd_branch_untrack(
.untrack_remote_branch(&name.branch, &name.remote);
}
tx.finish(ui)?;
if names.len() > 1 {
writeln!(
ui.stderr(),
"Stopped tracking {} remote branches.",
names.len()
)?;
}
Ok(())
}

View file

@ -778,7 +778,9 @@ fn test_branch_track_untrack_patterns() {
// Track by pattern
let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "track", "glob:feature?@origin"]);
insta::assert_snapshot!(stderr, @"");
insta::assert_snapshot!(stderr, @r###"
Started tracking 2 remote branches.
"###);
insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###"
feature1: omvolwpu 1336caed commit
@git: omvolwpu 1336caed commit