Skip to content

Commit

Permalink
cli: exit with CLI error status on "op abandon --at-op"
Browse files Browse the repository at this point in the history
The command option --at-op isn't supported by "op abandon", so it's rather a
CLI error.
  • Loading branch information
yuja committed Jul 24, 2024
1 parent b9e82f6 commit c705afa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cli/src/commands/operation/abandon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use jj_lib::op_walk;
use jj_lib::operation::Operation;

use crate::cli_util::{short_operation_hash, CommandHelper};
use crate::command_error::{user_error, user_error_with_hint, CommandError};
use crate::command_error::{cli_error, user_error, user_error_with_hint, CommandError};
use crate::ui::Ui;

/// Abandon operation history
Expand Down Expand Up @@ -55,7 +55,7 @@ pub fn cmd_op_abandon(
// with the current head.
let head_op_str = &command.global_args().at_operation;
if head_op_str != "@" {
return Err(user_error("--at-op is not respected"));
return Err(cli_error("--at-op is not respected"));
}
let current_head_op = op_walk::resolve_op_for_load(repo_loader, head_op_str)?;
let resolve_op = |op_str| op_walk::resolve_op_at(op_store, &current_head_op, op_str);
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ fn test_op_abandon_ancestors() {
"###);

// Can't create concurrent abandoned operations explicitly.
let stderr = test_env.jj_cmd_failure(&repo_path, &["op", "abandon", "--at-op=@-", "@"]);
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["op", "abandon", "--at-op=@-", "@"]);
insta::assert_snapshot!(stderr, @r###"
Error: --at-op is not respected
"###);
Expand Down

0 comments on commit c705afa

Please sign in to comment.