Skip to content

Commit

Permalink
cli: include branch name in non-fast-forwardable error
Browse files Browse the repository at this point in the history
Just like the other errors.
  • Loading branch information
yuja committed Nov 10, 2023
1 parent 8706fad commit 9533177
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/src/commands/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ fn cmd_branch_set(
}
if !args.allow_backwards && !is_fast_forward(old_target) {
return Err(user_error_with_hint(
"Refusing to move branch backwards or sideways.",
format!("Refusing to move branch backwards or sideways: {name}"),
"Use --allow-backwards to allow it.",
));
}
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_branch_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn test_branch_move() {

let stderr = test_env.jj_cmd_failure(&repo_path, &["branch", "set", "-r@-", "foo"]);
insta::assert_snapshot!(stderr, @r###"
Error: Refusing to move branch backwards or sideways.
Error: Refusing to move branch backwards or sideways: foo
Hint: Use --allow-backwards to allow it.
"###);

Expand Down Expand Up @@ -169,7 +169,7 @@ fn test_branch_move_conflicting() {
let stderr =
test_env.jj_cmd_failure(&repo_path, &["branch", "set", "-rdescription(C0)", "foo"]);
insta::assert_snapshot!(stderr, @r###"
Error: Refusing to move branch backwards or sideways.
Error: Refusing to move branch backwards or sideways: foo
Hint: Use --allow-backwards to allow it.
"###);

Expand Down

0 comments on commit 9533177

Please sign in to comment.