forked from mirrors/jj
templater: do not complete "(no commit description)" by default
This allows us to use "if(description,)" to test empty description. And I think this change is unavoidable if we want to add support for commit template.
This commit is contained in:
parent
12d8c4ef01
commit
e63ea86841
18 changed files with 91 additions and 93 deletions
|
@ -30,6 +30,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
Operations written by a new `jj` binary will have a "HEAD@git" reference that
|
||||
is not visible to older binaries.
|
||||
|
||||
* The `description` template keyword is now empty if no description set.
|
||||
Use `if(description, description, "(no description set)\n")` to get back
|
||||
the previous behavior.
|
||||
|
||||
### New features
|
||||
|
||||
* The default log format now uses the committer timestamp instead of the author
|
||||
|
|
|
@ -1446,6 +1446,9 @@ pub fn update_working_copy(
|
|||
Ok(stats)
|
||||
}
|
||||
|
||||
pub const DESCRIPTION_PLACEHOLDER_TEMPLATE: &str =
|
||||
r#"label("description", "(no description set)")"#;
|
||||
|
||||
pub fn write_commit_summary(
|
||||
formatter: &mut dyn Formatter,
|
||||
repo: RepoRef,
|
||||
|
@ -1456,7 +1459,14 @@ pub fn write_commit_summary(
|
|||
let template_string = settings
|
||||
.config()
|
||||
.get_string("template.commit_summary")
|
||||
.unwrap_or_else(|_| String::from(r#"commit_id.short() " " description.first_line()"#));
|
||||
.unwrap_or_else(|_| {
|
||||
format!(
|
||||
r#"
|
||||
commit_id.short() " "
|
||||
if(description, description.first_line(), {DESCRIPTION_PLACEHOLDER_TEMPLATE})
|
||||
"#,
|
||||
)
|
||||
});
|
||||
let template =
|
||||
crate::template_parser::parse_commit_template(repo, workspace_id, &template_string);
|
||||
template.format(commit, formatter)
|
||||
|
|
|
@ -49,6 +49,7 @@ use crate::cli_util::{
|
|||
self, check_stale_working_copy, print_checkout_stats, resolve_base_revs, run_ui_editor,
|
||||
short_commit_hash, user_error, user_error_with_hint, write_config_entry, Args, CommandError,
|
||||
CommandHelper, DescriptionArg, RevisionArg, WorkspaceCommandHelper,
|
||||
DESCRIPTION_PLACEHOLDER_TEMPLATE,
|
||||
};
|
||||
use crate::config::config_path;
|
||||
use crate::diff_util::{self, DiffFormat, DiffFormatArgs};
|
||||
|
@ -1242,7 +1243,7 @@ fn cmd_show(ui: &mut Ui, command: &CommandHelper, args: &ShowArgs) -> Result<(),
|
|||
"Author: " author " (" {author_timestamp_template} ")\n"
|
||||
"Committer: " committer " (" {committer_timestamp_template} ")\n"
|
||||
"\n"
|
||||
description
|
||||
if(description, description, {DESCRIPTION_PLACEHOLDER_TEMPLATE} "\n")
|
||||
"\n""#,
|
||||
);
|
||||
let template = crate::template_parser::parse_commit_template(
|
||||
|
@ -1397,7 +1398,7 @@ fn log_template(settings: &UserSettings) -> String {
|
|||
if(conflict, label("conflict", " conflict"))
|
||||
"\n"
|
||||
if(empty, label("empty", "(empty) "))
|
||||
description.first_line()
|
||||
if(description, description.first_line(), {DESCRIPTION_PLACEHOLDER_TEMPLATE})
|
||||
"\n""#,
|
||||
);
|
||||
settings
|
||||
|
|
|
@ -23,7 +23,7 @@ use jujutsu_lib::repo::RepoRef;
|
|||
use jujutsu_lib::rewrite::merge_commit_trees;
|
||||
|
||||
use crate::formatter::Formatter;
|
||||
use crate::time_util;
|
||||
use crate::{cli_util, time_util};
|
||||
|
||||
pub trait Template<C> {
|
||||
fn format(&self, context: &C, formatter: &mut dyn Formatter) -> io::Result<()>;
|
||||
|
@ -211,11 +211,7 @@ impl TemplateProperty<Commit> for DescriptionProperty {
|
|||
type Output = String;
|
||||
|
||||
fn extract(&self, context: &Commit) -> Self::Output {
|
||||
match context.description() {
|
||||
s if s.is_empty() => "(no description set)\n".to_owned(),
|
||||
s if s.ends_with('\n') => s.to_owned(),
|
||||
s => format!("{s}\n"),
|
||||
}
|
||||
cli_util::complete_newline(context.description())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ fn test_checkout() {
|
|||
Working copy now at: 05ce7118568d (no description set)
|
||||
"###);
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
@ 05ce7118568d3007efc9163b055f9cb4a6becfde (no description set)
|
||||
@ 05ce7118568d3007efc9163b055f9cb4a6becfde
|
||||
o 5c52832c3483e0ace06d047a806024984f28f1d7 second
|
||||
o 69542c1984c1f9d91f7c6c9c9e6941782c944bd9 first
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
|
||||
// Can provide a description
|
||||
|
@ -46,7 +46,7 @@ fn test_checkout() {
|
|||
| o 5c52832c3483e0ace06d047a806024984f28f1d7 second
|
||||
|/
|
||||
o 69542c1984c1f9d91f7c6c9c9e6941782c944bd9 first
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ fn test_commit_with_description_from_cli() {
|
|||
// Description applies to the current working-copy (not the new one)
|
||||
test_env.jj_cmd_success(&workspace_path, &["commit", "-m=first"]);
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###"
|
||||
@ b88fb4e51bdd (no description set)
|
||||
@ b88fb4e51bdd
|
||||
o 69542c1984c1 first
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ fn test_commit_with_editor() {
|
|||
std::fs::write(&edit_script, ["dump editor0", "write\nmodified"].join("\0")).unwrap();
|
||||
test_env.jj_cmd_success(&workspace_path, &["commit"]);
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###"
|
||||
@ 3df78bc2b9b5 (no description set)
|
||||
@ 3df78bc2b9b5
|
||||
o 30a8c2b3d6eb modified
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
insta::assert_snapshot!(
|
||||
std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###"
|
||||
|
|
|
@ -37,7 +37,7 @@ fn test_concurrent_operation_divergence() {
|
|||
o message 2
|
||||
| @ message 1
|
||||
|/
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ fn test_concurrent_operations_auto_rebase() {
|
|||
Rebased 1 descendant commits onto commits rewritten by other operation
|
||||
o 3f06323826b4a293a9ee6d24cc0e07ad2961b5d5 new child
|
||||
@ d91437157468ec86bbbc9e6a14a60d3e8d1790ac rewritten
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ fn test_concurrent_operations_wc_modified() {
|
|||
| o 4b20e61d23ee7d7c4d5e61e11e97c26e716f9c30 new child2
|
||||
|/
|
||||
o 52c893bf3cd201e215b23e084e8a871244ca14d5 initial
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
|
|
|
@ -275,7 +275,6 @@ fn test_color_words_diff_missing_newline() {
|
|||
&["log", "-Tdescription", "-pr:@-", "--no-graph", "--reversed"],
|
||||
);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
(no description set)
|
||||
=== Empty
|
||||
Added regular file file1:
|
||||
=== Add no newline
|
||||
|
@ -369,7 +368,6 @@ fn test_diff_skipped_context() {
|
|||
&["log", "-Tdescription", "-p", "--no-graph", "--reversed"],
|
||||
);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
(no description set)
|
||||
=== Left side of diffs
|
||||
Added regular file file1:
|
||||
1: a
|
||||
|
|
|
@ -46,7 +46,7 @@ fn test_duplicate() {
|
|||
o | d370aee184ba b
|
||||
| o 2443ea76b0b1 a
|
||||
|/
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["duplicate", "root"]);
|
||||
|
@ -66,7 +66,7 @@ fn test_duplicate() {
|
|||
|/ /
|
||||
| o 2443ea76b0b1 a
|
||||
|/
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["undo"]), @"");
|
||||
|
@ -85,7 +85,7 @@ fn test_duplicate() {
|
|||
o | d370aee184ba b
|
||||
| o 2443ea76b0b1 a
|
||||
|/
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ fn test_duplicate_many() {
|
|||
| o 1394f625cbbd b
|
||||
|/
|
||||
o 2443ea76b0b1 a
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["duplicate", "b:"]);
|
||||
|
@ -130,7 +130,7 @@ fn test_duplicate_many() {
|
|||
| o 1394f625cbbd b
|
||||
|/
|
||||
o 2443ea76b0b1 a
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
// Try specifying the same commit twice directly
|
||||
|
@ -149,7 +149,7 @@ fn test_duplicate_many() {
|
|||
| o 1394f625cbbd b
|
||||
|/
|
||||
o 2443ea76b0b1 a
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
// Try specifying the same commit twice indirectly
|
||||
|
@ -175,7 +175,7 @@ fn test_duplicate_many() {
|
|||
| o 1394f625cbbd b
|
||||
|/
|
||||
o 2443ea76b0b1 a
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
|
@ -188,7 +188,7 @@ fn test_duplicate_many() {
|
|||
| o 1394f625cbbd b
|
||||
|/
|
||||
o 2443ea76b0b1 a
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["duplicate", "d:", "a"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
|
@ -213,7 +213,7 @@ fn test_duplicate_many() {
|
|||
|/ /
|
||||
o | 2443ea76b0b1 a
|
||||
|/
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
// Check for BUG -- makes too many 'a'-s, etc.
|
||||
|
@ -242,7 +242,7 @@ fn test_duplicate_many() {
|
|||
| |/
|
||||
| o 2443ea76b0b1 a
|
||||
|/
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ fn test_undo_after_duplicate() {
|
|||
create_commit(&test_env, &repo_path, "a", &[]);
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
@ 2443ea76b0b1 a
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["duplicate", "a"]);
|
||||
|
@ -267,13 +267,13 @@ fn test_undo_after_duplicate() {
|
|||
o f5cefcbb65a4 a
|
||||
| @ 2443ea76b0b1 a
|
||||
|/
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["undo"]), @"");
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
@ 2443ea76b0b1 a
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ fn test_rebase_duplicates() {
|
|||
insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r###"
|
||||
@ 1394f625cbbd b @ 2001-02-03 04:05:11.000 +07:00
|
||||
o 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00
|
||||
o 000000000000 (no description set) @ 1970-01-01 00:00:00.000 +00:00
|
||||
o 000000000000 @ 1970-01-01 00:00:00.000 +00:00
|
||||
"###);
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["duplicate", "b"]);
|
||||
|
@ -308,7 +308,7 @@ fn test_rebase_duplicates() {
|
|||
| @ 1394f625cbbd b @ 2001-02-03 04:05:11.000 +07:00
|
||||
|/
|
||||
o 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00
|
||||
o 000000000000 (no description set) @ 1970-01-01 00:00:00.000 +00:00
|
||||
o 000000000000 @ 1970-01-01 00:00:00.000 +00:00
|
||||
"###);
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["rebase", "-s", "a", "-d", "a-"]);
|
||||
|
@ -325,7 +325,7 @@ fn test_rebase_duplicates() {
|
|||
| @ 29bd36b60e60 b @ 2001-02-03 04:05:16.000 +07:00
|
||||
|/
|
||||
o 2f6dc5a1ffc2 a @ 2001-02-03 04:05:16.000 +07:00
|
||||
o 000000000000 (no description set) @ 1970-01-01 00:00:00.000 +00:00
|
||||
o 000000000000 @ 1970-01-01 00:00:00.000 +00:00
|
||||
"###);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ fn test_edit() {
|
|||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
o b2f7e9c549aa second
|
||||
@ f41390a5efbf first
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
insta::assert_snapshot!(read_file(&repo_path.join("file1")), @"0");
|
||||
|
||||
|
@ -58,7 +58,7 @@ fn test_edit() {
|
|||
Rebased 1 descendant commits onto updated working copy
|
||||
o 51d937a3eeb4 second
|
||||
@ 409306de8f44 first
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ fn test_edit_current_wc_commit_missing() {
|
|||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
o 5c52832c3483 second
|
||||
@ 69542c1984c1 first
|
||||
o 000000000000 (no description set)
|
||||
o 000000000000
|
||||
"###);
|
||||
|
||||
// Make the Git backend fail to read the current working copy commit
|
||||
|
|
|
@ -275,26 +275,26 @@ fn test_git_colocated_squash_undo() {
|
|||
test_env.jj_cmd_success(&repo_path, &["ci", "-m=A"]);
|
||||
// Test the setup
|
||||
insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r###"
|
||||
@ 8e4fac809cbb 8f71e3b6a3be (no description set)
|
||||
@ 8e4fac809cbb 8f71e3b6a3be
|
||||
o 9a45c67d3e96 a86754f975f9 A master
|
||||
o 000000000000 000000000000 (no description set)
|
||||
o 000000000000 000000000000
|
||||
"###);
|
||||
|
||||
test_env.jj_cmd_success(&repo_path, &["squash"]);
|
||||
insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r###"
|
||||
@ 0757f5ec8418 f0c12b0396d9 (no description set)
|
||||
@ 0757f5ec8418 f0c12b0396d9
|
||||
o 9a45c67d3e96 2f376ea1478c A master
|
||||
o 000000000000 000000000000 (no description set)
|
||||
o 000000000000 000000000000
|
||||
"###);
|
||||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
// TODO: There should be no divergence here; 2f376ea1478c should be hidden
|
||||
// (#922)
|
||||
insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r###"
|
||||
o 9a45c67d3e96 2f376ea1478c A master !divergence!
|
||||
| @ 8e4fac809cbb 8f71e3b6a3be (no description set)
|
||||
| @ 8e4fac809cbb 8f71e3b6a3be
|
||||
| o 9a45c67d3e96 a86754f975f9 A !divergence!
|
||||
|/
|
||||
o 000000000000 000000000000 (no description set)
|
||||
o 000000000000 000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ fn test_log_with_or_without_diff() {
|
|||
insta::assert_snapshot!(stdout, @r###"
|
||||
@ a new commit
|
||||
o add a file
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p"]);
|
||||
|
@ -57,14 +57,13 @@ fn test_log_with_or_without_diff() {
|
|||
o add a file
|
||||
| Added regular file file1:
|
||||
| 1: foo
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--no-graph"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
a new commit
|
||||
add a file
|
||||
(no description set)
|
||||
"###);
|
||||
|
||||
// `-p` for default diff output, `-s` for summary
|
||||
|
@ -79,7 +78,7 @@ fn test_log_with_or_without_diff() {
|
|||
| A file1
|
||||
| Added regular file file1:
|
||||
| 1: foo
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// `-s` for summary, `--git` for git diff (which implies `-p`)
|
||||
|
@ -103,7 +102,7 @@ fn test_log_with_or_without_diff() {
|
|||
| +++ b/file1
|
||||
| @@ -1,0 +1,1 @@
|
||||
| +foo
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// `-p` enables default "summary" output, so `-s` is noop
|
||||
|
@ -123,7 +122,7 @@ fn test_log_with_or_without_diff() {
|
|||
| M file1
|
||||
o add a file
|
||||
| A file1
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// `-p` enables default "color-words" diff output, so `--color-words` is noop
|
||||
|
@ -139,7 +138,7 @@ fn test_log_with_or_without_diff() {
|
|||
o add a file
|
||||
| Added regular file file1:
|
||||
| 1: foo
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// `--git` enables git diff, so `-p` is noop
|
||||
|
@ -164,7 +163,6 @@ fn test_log_with_or_without_diff() {
|
|||
+++ b/file1
|
||||
@@ -1,0 +1,1 @@
|
||||
+foo
|
||||
(no description set)
|
||||
"###);
|
||||
|
||||
// Both formats enabled if `--git` and `--color-words` are explicitly specified
|
||||
|
@ -202,7 +200,6 @@ fn test_log_with_or_without_diff() {
|
|||
+foo
|
||||
Added regular file file1:
|
||||
1: foo
|
||||
(no description set)
|
||||
"###);
|
||||
|
||||
// `-s` with or without graph
|
||||
|
@ -212,7 +209,7 @@ fn test_log_with_or_without_diff() {
|
|||
| M file1
|
||||
o add a file
|
||||
| A file1
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(
|
||||
&repo_path,
|
||||
|
@ -223,7 +220,6 @@ fn test_log_with_or_without_diff() {
|
|||
M file1
|
||||
add a file
|
||||
A file1
|
||||
(no description set)
|
||||
"###);
|
||||
|
||||
// `--git` implies `-p`, with or without graph
|
||||
|
@ -356,7 +352,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
|
|||
test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", prefix_format]),
|
||||
@r###"
|
||||
@ Change 9[a45c67d3e] initial b[a1a30916d] original
|
||||
o Change 0[000000000] (no description set) 0[000000000]
|
||||
o Change 0[000000000] 0[000000000]
|
||||
"###
|
||||
);
|
||||
for i in 1..100 {
|
||||
|
@ -376,7 +372,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
|
|||
test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", prefix_format]),
|
||||
@r###"
|
||||
@ Change 9a4[5c67d3e] commit99 de[3177d2ac] original
|
||||
o Change 000[0000000] (no description set) 000[0000000]
|
||||
o Change 000[0000000] 000[0000000]
|
||||
"###
|
||||
);
|
||||
insta::assert_snapshot!(
|
||||
|
@ -413,7 +409,7 @@ fn test_log_divergence() {
|
|||
// No divergence
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
@ description 1
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// Create divergence
|
||||
|
@ -434,7 +430,7 @@ fn test_log_divergence() {
|
|||
o description 2 !divergence!
|
||||
| @ description 1 !divergence!
|
||||
|/
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -449,7 +445,7 @@ fn test_log_reversed() {
|
|||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--reversed"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
o (no description set)
|
||||
o
|
||||
o first
|
||||
@ second
|
||||
"###);
|
||||
|
@ -459,7 +455,6 @@ fn test_log_reversed() {
|
|||
&["log", "-T", "description", "--reversed", "--no-graph"],
|
||||
);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
(no description set)
|
||||
first
|
||||
second
|
||||
"###);
|
||||
|
@ -540,7 +535,7 @@ fn test_log_warn_path_might_be_revset() {
|
|||
.assert()
|
||||
.success();
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @r###"
|
||||
@ (no description set)
|
||||
@
|
||||
~
|
||||
"###);
|
||||
insta::assert_snapshot!(get_stderr_string(&assert), @"");
|
||||
|
@ -551,7 +546,7 @@ fn test_log_warn_path_might_be_revset() {
|
|||
.assert()
|
||||
.success();
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @r###"
|
||||
@ (no description set)
|
||||
@
|
||||
~
|
||||
"###);
|
||||
insta::assert_snapshot!(get_stderr_string(&assert), @r###"warning: The argument "." is being interpreted as a path, but this is often not useful because all non-empty commits touch '.'. If you meant to show the working copy commit, pass -r '@' instead."###);
|
||||
|
@ -670,7 +665,7 @@ fn test_graph_template_color() {
|
|||
o first line
|
||||
| second line
|
||||
| third line
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "log", "-T=description"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
|
@ -678,7 +673,7 @@ fn test_graph_template_color() {
|
|||
o [38;5;1mfirst line[39m
|
||||
| [38;5;1msecond line[39m
|
||||
| [38;5;1mthird line[39m
|
||||
o [38;5;1m(no description set)[39m
|
||||
o
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -714,7 +709,7 @@ fn test_graph_styles() {
|
|||
|/
|
||||
o main branch 1
|
||||
o initial
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// ASCII style
|
||||
|
@ -731,7 +726,7 @@ fn test_graph_styles() {
|
|||
|/
|
||||
o main branch 1
|
||||
o initial
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// Large ASCII style
|
||||
|
@ -750,7 +745,7 @@ fn test_graph_styles() {
|
|||
|/
|
||||
o main branch 1
|
||||
o initial
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// Curved style
|
||||
|
@ -767,7 +762,7 @@ fn test_graph_styles() {
|
|||
├─╯
|
||||
o main branch 1
|
||||
o initial
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
|
||||
// Square style
|
||||
|
@ -784,6 +779,6 @@ fn test_graph_styles() {
|
|||
├─┘
|
||||
o main branch 1
|
||||
o initial
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
}
|
||||
|
|
|
@ -339,9 +339,7 @@ fn test_move_description() {
|
|||
std::fs::write(repo_path.join("file1"), "b\n").unwrap();
|
||||
std::fs::write(repo_path.join("file2"), "b\n").unwrap();
|
||||
test_env.jj_cmd_success(&repo_path, &["move", "--to", "@-"]);
|
||||
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@-"), @r###"
|
||||
(no description set)
|
||||
"###);
|
||||
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@-"), @"");
|
||||
|
||||
// If the destination's description is empty and the source's description is
|
||||
// non-empty, the resulting description is from the source
|
||||
|
|
|
@ -30,7 +30,7 @@ fn test_new() {
|
|||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
@ 4f2d6e0a3482a6a34e4856a4a63869c0df109e79 a new commit
|
||||
o 5d5c60b2aa96b8dbf55710656c50285c66cdcd74 add a file
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
|
||||
// Start a new change off of a specific commit (the root commit in this case).
|
||||
|
@ -40,7 +40,7 @@ fn test_new() {
|
|||
| o 4f2d6e0a3482a6a34e4856a4a63869c0df109e79 a new commit
|
||||
| o 5d5c60b2aa96b8dbf55710656c50285c66cdcd74 add a file
|
||||
|/
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
}
|
||||
|
||||
|
@ -59,12 +59,12 @@ fn test_new_merge() {
|
|||
// Create a merge commit
|
||||
test_env.jj_cmd_success(&repo_path, &["new", "main", "@"]);
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
@ 0c4e5b9b68ae0cbe7ce3c61042619513d09005bf (no description set)
|
||||
@ 0c4e5b9b68ae0cbe7ce3c61042619513d09005bf
|
||||
|\
|
||||
o | f399209d9dda06e8a25a0c8e9a0cde9f421ff35d add file2
|
||||
| o 38e8e2f6c92ffb954961fc391b515ff551b41636 add file1
|
||||
|/
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["print", "file1"]);
|
||||
insta::assert_snapshot!(stdout, @"a");
|
||||
|
@ -75,12 +75,12 @@ fn test_new_merge() {
|
|||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
test_env.jj_cmd_success(&repo_path, &["merge", "main", "@"]);
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
@ 200ed1a14c8acf09783dafefe5bebf2ff58f12fd (no description set)
|
||||
@ 200ed1a14c8acf09783dafefe5bebf2ff58f12fd
|
||||
|\
|
||||
o | f399209d9dda06e8a25a0c8e9a0cde9f421ff35d add file2
|
||||
| o 38e8e2f6c92ffb954961fc391b515ff551b41636 add file1
|
||||
|/
|
||||
o 0000000000000000000000000000000000000000 (no description set)
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
|
||||
// `jj merge` with less than two arguments is an error
|
||||
|
|
|
@ -255,9 +255,7 @@ fn test_squash_description() {
|
|||
std::fs::write(repo_path.join("file1"), "b\n").unwrap();
|
||||
std::fs::write(repo_path.join("file2"), "b\n").unwrap();
|
||||
test_env.jj_cmd_success(&repo_path, &["squash"]);
|
||||
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@-"), @r###"
|
||||
(no description set)
|
||||
"###);
|
||||
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@-"), @"");
|
||||
|
||||
// If the destination's description is empty and the source's description is
|
||||
// non-empty, the resulting description is from the source
|
||||
|
|
|
@ -33,7 +33,7 @@ fn test_undo_rewrite_with_child() {
|
|||
insta::assert_snapshot!(stdout, @r###"
|
||||
@ child
|
||||
o modified
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
test_env.jj_cmd_success(&repo_path, &["undo", &op_id_hex]);
|
||||
|
||||
|
@ -43,6 +43,6 @@ fn test_undo_rewrite_with_child() {
|
|||
insta::assert_snapshot!(stdout, @r###"
|
||||
@ child
|
||||
o initial
|
||||
o (no description set)
|
||||
o
|
||||
"###);
|
||||
}
|
||||
|
|
|
@ -221,9 +221,7 @@ fn test_unsquash_description() {
|
|||
std::fs::write(repo_path.join("file1"), "b\n").unwrap();
|
||||
std::fs::write(repo_path.join("file2"), "b\n").unwrap();
|
||||
test_env.jj_cmd_success(&repo_path, &["unsquash"]);
|
||||
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@"), @r###"
|
||||
(no description set)
|
||||
"###);
|
||||
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@"), @"");
|
||||
|
||||
// If the destination's description is empty and the source's description is
|
||||
// non-empty, the resulting description is from the source
|
||||
|
|
|
@ -233,14 +233,14 @@ fn test_list_workspaces_template() {
|
|||
// "current_working_copy" should point to the workspace we operate on
|
||||
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
default: e0e6d5672858 (no description set) (current)
|
||||
second: f68da2d114f1 (no description set)
|
||||
default: e0e6d5672858 (current)
|
||||
second: f68da2d114f1
|
||||
"###);
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "list"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
default: e0e6d5672858 (no description set)
|
||||
second: f68da2d114f1 (no description set) (current)
|
||||
default: e0e6d5672858
|
||||
second: f68da2d114f1 (current)
|
||||
"###);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue