Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jj rebase --after main causes thread panic #4770

Closed
sean-c-johnston opened this issue Nov 5, 2024 · 2 comments · Fixed by #4779
Closed

jj rebase --after main causes thread panic #4770

sean-c-johnston opened this issue Nov 5, 2024 · 2 comments · Fixed by #4779
Labels
🐛bug Something isn't working

Comments

@sean-c-johnston
Copy link

Description

When using jj rebase with no -r -s or -b argument, I believe the default behaviour is the same as jj rebase -b @ <args>.

It seems that --after is not a valid argument to combine with -b, but the cli does not properly display a friendly error in the "implicit" case.

Steps to Reproduce the Problem

  1. Run jj rebase --after <revision> in a jj repository.

Expected Behavior

Displaying the same error as explicitly running jj rebase -b @ --after main:

error: the argument '--branch <BRANCH>' cannot be used with '--insert-after <INSERT_AFTER>'

Actual Behavior

❯ jj rebase --after main

thread 'main' panicked at cli/src/commands/rebase.rs:274:14:
clap should enforce -d when used with -b

Output from running with RUST_BACKTRACE=full:

stack backtrace:
   0:        0x1031d2e74 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1f3776e0b5c7517d
   1:        0x1031f4b1c - core::fmt::write::heedef092c8c0962e
   2:        0x1031cdff8 - std::io::Write::write_fmt::h7178e8e2ea928914
   3:        0x1031d2ccc - std::sys_common::backtrace::print::h417292deb95532ed
   4:        0x1031d48bc - std::panicking::default_hook::{{closure}}::h0cb68f1228c4613a
   5:        0x1031d45b0 - std::panicking::default_hook::h24535936bc1f51de
   6:        0x1031d5174 - std::panicking::rust_panic_with_hook::h5db4d2345b297bed
   7:        0x1031d4ba4 - std::panicking::begin_panic_handler::{{closure}}::h3fd558f09a0d5492
   8:        0x1031d32fc - std::sys_common::backtrace::__rust_end_short_backtrace::hfc76eebe1ce501b2
   9:        0x1031d4914 - _rust_begin_unwind
  10:        0x103248150 - core::panicking::panic_fmt::hc2b459a5bd3dce66
  11:        0x1031f2744 - core::panicking::panic_display::hf23c98a61b03dc30
  12:        0x103248124 - core::option::expect_failed::hd7f592634f4db1af
  13:        0x102a93268 - jj_cli::commands::rebase::cmd_rebase::h22f4bf097df4c29c
  14:        0x102abedd4 - jj_cli::commands::run_command::h9b85c15c858d0dc4
  15:        0x10291fc14 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hac56075794e9a253
  16:        0x102a29b74 - jj_cli::cli_util::CliRunner::run::h174009057440dd27
  17:        0x10281e404 - jj::main::hedfc4096854b2cbc
  18:        0x10281e384 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8e2c448e74e53942
  19:        0x10281e39c - std::rt::lang_start::{{closure}}::h58b1bf8200ea7633
  20:        0x1031c5dfc - std::rt::lang_start_internal::hecc68fef83c8f44d
  21:        0x10281e448 - _main

Specifications

  • Platform: macOS
  • Version: jj 0.22.0-1d7aaa6f8d8db233e25fa4a3627506f280a8c2ea

Specifically the openSSH fork by bnjmnt4n

@yuja
Copy link
Collaborator

yuja commented Nov 5, 2024

cc @bnjmnt4n

It might be easier to add let Some(..) = .. else { return cli_error(..); } instead of relying on clap.

@bnjmnt4n
Copy link
Collaborator

bnjmnt4n commented Nov 6, 2024

I've created a quick PR #4779 to fix this. In the future, I believe we should be able to remove this restriction anyway and allow -b with --after/--before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants