mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-10 14:16:24 +03:00
cli: make short_commit_description() compatible with default summary template
This commit is contained in:
parent
3e50844afa
commit
15e51315ec
@ -1422,10 +1422,10 @@ pub fn run_ui_editor(settings: &UserSettings, edit_path: &PathBuf) -> Result<(),
|
||||
pub fn short_commit_description(commit: &Commit) -> String {
|
||||
let first_line = commit.description().split('\n').next().unwrap();
|
||||
format!(
|
||||
"{} ({})",
|
||||
"{} {}",
|
||||
short_commit_hash(commit.id()),
|
||||
if first_line.is_empty() {
|
||||
"no description set"
|
||||
"(no description set)"
|
||||
} else {
|
||||
first_line
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ fn test_checkout_not_single_rev() {
|
||||
Error: Revset "root..@" resolved to more than one revision
|
||||
Hint: The revset resolved to these revisions:
|
||||
2f8593712db5 (no description set)
|
||||
5c1afd8b074f (fifth)
|
||||
009f88bf7141 (fourth)
|
||||
3fa8931e7b89 (third)
|
||||
5c52832c3483 (second)
|
||||
5c1afd8b074f fifth
|
||||
009f88bf7141 fourth
|
||||
3fa8931e7b89 third
|
||||
5c52832c3483 second
|
||||
...
|
||||
"###);
|
||||
|
||||
@ -78,19 +78,19 @@ fn test_checkout_not_single_rev() {
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Error: Revset "root..@-" resolved to more than one revision
|
||||
Hint: The revset resolved to these revisions:
|
||||
5c1afd8b074f (fifth)
|
||||
009f88bf7141 (fourth)
|
||||
3fa8931e7b89 (third)
|
||||
5c52832c3483 (second)
|
||||
69542c1984c1 (first)
|
||||
5c1afd8b074f fifth
|
||||
009f88bf7141 fourth
|
||||
3fa8931e7b89 third
|
||||
5c52832c3483 second
|
||||
69542c1984c1 first
|
||||
"###);
|
||||
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "@-|@--"]);
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Error: Revset "@-|@--" resolved to more than one revision
|
||||
Hint: The revset resolved to these revisions:
|
||||
5c1afd8b074f (fifth)
|
||||
009f88bf7141 (fourth)
|
||||
5c1afd8b074f fifth
|
||||
009f88bf7141 fourth
|
||||
"###);
|
||||
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "none()"]);
|
||||
|
Loading…
Reference in New Issue
Block a user