Skip to content

Commit 9f3916e

Browse files
committed
add error for committing an empty file set without a message
hit this a few times unintentionally doing AoC, where the warnign shown is hidden by the new editor opening
1 parent 11f58fc commit 9f3916e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cli/src/commands/commit.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ new working-copy commit.
159159
"The given paths do not match any file: {}",
160160
args.paths.join(" ")
161161
)?;
162+
163+
if args.message_paragraphs.is_empty() {
164+
let error = format!(
165+
"Did you mean `commit --message \"{}\"` ?",
166+
args.paths.join(" ")
167+
);
168+
169+
return Err(CommandError::new(
170+
crate::command_error::CommandErrorKind::User,
171+
error,
172+
));
173+
}
162174
}
163175

164176
let mut commit_builder = tx.repo_mut().rewrite_commit(&commit).detach();

0 commit comments

Comments
 (0)