mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-18 05:34:26 +00: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 {
|
pub fn short_commit_description(commit: &Commit) -> String {
|
||||||
let first_line = commit.description().split('\n').next().unwrap();
|
let first_line = commit.description().split('\n').next().unwrap();
|
||||||
format!(
|
format!(
|
||||||
"{} ({})",
|
"{} {}",
|
||||||
short_commit_hash(commit.id()),
|
short_commit_hash(commit.id()),
|
||||||
if first_line.is_empty() {
|
if first_line.is_empty() {
|
||||||
"no description set"
|
"(no description set)"
|
||||||
} else {
|
} else {
|
||||||
first_line
|
first_line
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,10 @@ fn test_checkout_not_single_rev() {
|
|||||||
Error: Revset "root..@" resolved to more than one revision
|
Error: Revset "root..@" resolved to more than one revision
|
||||||
Hint: The revset resolved to these revisions:
|
Hint: The revset resolved to these revisions:
|
||||||
2f8593712db5 (no description set)
|
2f8593712db5 (no description set)
|
||||||
5c1afd8b074f (fifth)
|
5c1afd8b074f fifth
|
||||||
009f88bf7141 (fourth)
|
009f88bf7141 fourth
|
||||||
3fa8931e7b89 (third)
|
3fa8931e7b89 third
|
||||||
5c52832c3483 (second)
|
5c52832c3483 second
|
||||||
...
|
...
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@ -78,19 +78,19 @@ fn test_checkout_not_single_rev() {
|
|||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
Error: Revset "root..@-" resolved to more than one revision
|
Error: Revset "root..@-" resolved to more than one revision
|
||||||
Hint: The revset resolved to these revisions:
|
Hint: The revset resolved to these revisions:
|
||||||
5c1afd8b074f (fifth)
|
5c1afd8b074f fifth
|
||||||
009f88bf7141 (fourth)
|
009f88bf7141 fourth
|
||||||
3fa8931e7b89 (third)
|
3fa8931e7b89 third
|
||||||
5c52832c3483 (second)
|
5c52832c3483 second
|
||||||
69542c1984c1 (first)
|
69542c1984c1 first
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "@-|@--"]);
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "@-|@--"]);
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
Error: Revset "@-|@--" resolved to more than one revision
|
Error: Revset "@-|@--" resolved to more than one revision
|
||||||
Hint: The revset resolved to these revisions:
|
Hint: The revset resolved to these revisions:
|
||||||
5c1afd8b074f (fifth)
|
5c1afd8b074f fifth
|
||||||
009f88bf7141 (fourth)
|
009f88bf7141 fourth
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "none()"]);
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "none()"]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user