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

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

Open
jyn514 opened this issue Feb 7, 2024 · 3 comments
Open

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

jyn514 opened this issue Feb 7, 2024 · 3 comments

Comments

@jyn514
Copy link
Contributor

jyn514 commented Feb 7, 2024

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 #2976

@yuja
Copy link
Contributor

yuja commented Feb 7, 2024

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

@arxanas
Copy link
Contributor

arxanas commented Feb 7, 2024

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.

@jyn514
Copy link
Contributor Author

jyn514 commented Feb 9, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants