cli: add jj describe --no-edit to not open editor

This commit is contained in:
Martin von Zweigbergk 2023-03-17 23:33:48 -07:00 committed by Martin von Zweigbergk
parent 3bacc367cd
commit fc84c02c8e
3 changed files with 10 additions and 2 deletions

View file

@ -56,7 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
been moved from `jj debug` to `jj support`.
* `jj describe` now supports `--reset-author` for resetting a commit's author
to the configured user.
to the configured user. `jj describe` also gained a `--no-edit` option to
avoid opening the editor.
### Fixed bugs

View file

@ -413,6 +413,11 @@ struct DescribeArgs {
/// Read the change description from stdin
#[arg(long)]
stdin: bool,
/// Don't open an editor
///
/// This is mainly useful in combination with e.g. `--reset-author`.
#[arg(long)]
no_edit: bool,
/// Reset the author to the configured user
///
/// This resets the author name, email, and timestamp.
@ -1807,6 +1812,8 @@ fn cmd_describe(
buffer
} else if let Some(message) = &args.message {
message.into()
} else if args.no_edit {
commit.description().to_owned()
} else {
let template = description_template_for_commit(&workspace_command, &commit)?;
edit_description(workspace_command.repo(), &template, command.settings())?

View file

@ -177,7 +177,7 @@ fn test_describe_author() {
"--config-toml",
r#"user.name = "Ove Ridder"
user.email = "ove.ridder@example.com""#,
"-m=description",
"--no-edit",
"--reset-author",
],
);