jj icon indicating copy to clipboard operation
jj copied to clipboard

FR: warn if the description is empty when this is likely unintended

Open jyn514 opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. in git, if the description is empty, it will cancel the commit altogether. jj instead creates a commit with an empty description.

this is ok, but it's probably not the intended behavior, especially if this is overwriting a previously non-empty description, or if the diff is empty.

Describe the solution you'd like jj should prompt interactively if you're sure in the following cases:

  • jj describe overwriting a non-empty description to empty
  • jj new creating an empty description for an empty diff (in the parent, to be clear, of course the working copy will be empty at first)
  • jj commit creating an empty description, regardless of the diff contents; people have muscle memory from git that an empty description cancels the commit.

Describe alternatives you've considered

  • only warn for a subset of these cases
  • don't add any warnings. i would prefer not to do this, i think it's a footgun.
  • add these warnings, but add a -y/--yes flag to ignore the warnings, restoring the current behavior.

Additional context cc https://github.com/martinvonz/jj/pull/2976

jyn514 avatar Feb 07 '24 03:02 jyn514

I think a warning is good as the user can simply jj undo. Interactive prompt is sometimes annoying.

yuja avatar Feb 07 '24 09:02 yuja

I think a warning is good as the user can simply jj undo. Interactive prompt is sometimes annoying.

git-branchless after hiding (abandoning) commits will print out a message like Hid X commits. If this was unintentional, run: git undo, and this is good because it doubles as an onboarding workflow, even if you never undo that operation in particular. We could conceivably add (more?) notes/warnings to run jj undo in various commands, including this one.

arxanas avatar Feb 07 '24 18:02 arxanas

frankly i forgot that jj undo exists :laughing: a warning that suggests jj undo sounds perfect!

jyn514 avatar Feb 09 '24 22:02 jyn514