Skip to content

FR: Recover better from jj split <change ID> #10022

Description

@zygoloid

Is your feature request related to a problem? Please describe.
I frequently forget the -r when running jj split. If I run jj split abc, because abc doesn't match any filenames, jj split decides that I want to split out an empty commit, and drops me straight into an editor to enter a commit message for the new empty commit. Depending on my editor, I may have no good way out of this other than to quit twice then jj undo.

jj split produces a warning, but I don't get to see it, because my editor has taken over the terminal. And if my editor doesn't use altscreen, then I don't even get to see it when I quit the editor!

Describe the solution you'd like
Really, anything better would be nice.

Describe alternatives you've considered
jj split abc, if abc matches no paths (or possibly if it matches no changes), could fail unless I specify --allow-empty or similar, at least in the case where abc is a valid change id. (See also #9245, which is a variant of this.)

Or jj could reject filesets that match no files in general. (I guess with a global flag to override.)

Or jj could detect when a filename input is a valid change id in general, and ask that you use a ./ prefix if that's what you really meant. (Probably not great for use from scripts.)

Or the editor that opens to enter the commit message could explain what happened, and maybe some special commit message such as "undo" or "abort" would bail out instead of creating the empty commit. I even think it'd be worth pre-filling the commit message with the special "abort" message so that quitting the editor without changing the message would abandon the split.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions