diff --git a/CHANGELOG.md b/CHANGELOG.md index 1445e289efe..592f7ada072 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Conflict markers now include an explanation of what each part of the conflict represents. +* `jj git push` now can push branches with empty commit descriptions with the + `--allow-empty-description` flag + ### Fixed bugs ## [0.17.1] - 2024-05-07 diff --git a/cli/src/commands/git.rs b/cli/src/commands/git.rs index 9f22ca7c4b6..457855059eb 100644 --- a/cli/src/commands/git.rs +++ b/cli/src/commands/git.rs @@ -220,6 +220,9 @@ pub struct GitPushArgs { /// correspond to missing local branches. #[arg(long)] deleted: bool, + /// Push branches with commits that contain empty descriptions + #[arg(long)] + allow_empty_description: bool, /// Push branches pointing to these commits (can be repeated) #[arg(long, short)] revisions: Vec, @@ -930,7 +933,7 @@ fn cmd_git_push( { let commit = commit?; let mut reasons = vec![]; - if commit.description().is_empty() { + if commit.description().is_empty() && !args.allow_empty_description { reasons.push("it has no description"); } if commit.author().name.is_empty() diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index ba895fff647..09970d0ccb3 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -931,6 +931,10 @@ By default, pushes any branches pointing to `remote_branches(remote=)..@ Possible values: `true`, `false` +* `--allow-empty-description` — Push branches with commits that contain empty descriptions + + Possible values: `true`, `false` + * `-r`, `--revisions ` — Push branches pointing to these commits (can be repeated) * `-c`, `--change ` — Push this commit by creating a branch based on its change ID (can be repeated) * `--dry-run` — Only display what will change on the remote diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 6d8bf2b2153..65e2a568e57 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -642,6 +642,16 @@ fn test_git_push_no_description() { insta::assert_snapshot!(stderr, @r###" Error: Won't push commit 5b36783cd11c since it has no description "###); + test_env.jj_cmd_ok( + &workspace_root, + &[ + "git", + "push", + "--branch", + "my-branch", + "--allow-empty-description", + ], + ); } #[test]