ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: exit with CLI error status on "op abandon --at-op"

The command option --at-op isn't supported by "op abandon", so it's rather a
CLI error.
This commit is contained in:
Yuya Nishihara 2024-07-23 13:46:13 +09:00
parent b9e82f6e06
commit c705afa299
2 changed files with 3 additions and 3 deletions

View file

@ -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
@ -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);

View file

@ -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
"###);