diff --git a/cli/src/config/templates.toml b/cli/src/config/templates.toml index 64d10062e4..049b9fd2fc 100644 --- a/cli/src/config/templates.toml +++ b/cli/src/config/templates.toml @@ -16,10 +16,9 @@ commit_summary = 'format_commit_summary_with_refs(self, bookmarks)' annotate_commit_summary = ''' separate(" ", - format_short_id(change_id), - format_short_id(commit_id), - format_short_signature(author), - format_timestamp(committer.timestamp()), + change_id.shortest(8), + pad_end(8, truncate_end(8, author.username())), + committer.timestamp().local().format('%Y-%m-%d %H:%M:%S'), ) ''' diff --git a/cli/tests/test_file_annotate_command.rs b/cli/tests/test_file_annotate_command.rs index 32f941c73a..a32bdef4f7 100644 --- a/cli/tests/test_file_annotate_command.rs +++ b/cli/tests/test_file_annotate_command.rs @@ -32,16 +32,19 @@ fn test_annotate_linear() { let repo_path = test_env.env_root().join("repo"); std::fs::write(repo_path.join("file.txt"), "line1\n").unwrap(); - test_env.jj_cmd_ok(&repo_path, &["describe", "-m=initial"]); + test_env.jj_cmd_ok( + &repo_path, + &["describe", "-m=initial", "--author=Foo "], + ); test_env.jj_cmd_ok(&repo_path, &["new", "-m=next"]); append_to_file(&repo_path.join("file.txt"), "new text from new commit"); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); - insta::assert_snapshot!(stdout, @r###" - qpvuntsm 8934c772 test.user@example.com 2001-02-03 08:05:08 1: line1 - kkmpptxz 41ae16e6 test.user@example.com 2001-02-03 08:05:10 2: new text from new commit - "###); + insta::assert_snapshot!(stdout, @r" + qpvuntsm foo 2001-02-03 08:05:08 1: line1 + kkmpptxz test.use 2001-02-03 08:05:10 2: new text from new commit + "); } #[test] @@ -72,11 +75,11 @@ fn test_annotate_merge() { .unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); - insta::assert_snapshot!(stdout, @r###" - qpvuntsm 8934c772 test.user@example.com 2001-02-03 08:05:08 1: line1 - zsuskuln 712ba14a test.user@example.com 2001-02-03 08:05:11 2: new text from new commit 1 - royxmykx b0571bd9 test.user@example.com 2001-02-03 08:05:13 3: new text from new commit 2 - "###); + insta::assert_snapshot!(stdout, @r" + qpvuntsm test.use 2001-02-03 08:05:08 1: line1 + zsuskuln test.use 2001-02-03 08:05:11 2: new text from new commit 1 + royxmykx test.use 2001-02-03 08:05:13 3: new text from new commit 2 + "); } #[test] @@ -102,15 +105,15 @@ fn test_annotate_conflicted() { test_env.jj_cmd_ok(&repo_path, &["new"]); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); - insta::assert_snapshot!(stdout, @r###" - qpvuntsm 8934c772 test.user@example.com 2001-02-03 08:05:08 1: line1 - yostqsxw 7b90c9f6 test.user@example.com 2001-02-03 08:05:15 2: <<<<<<< Conflict 1 of 1 - yostqsxw 7b90c9f6 test.user@example.com 2001-02-03 08:05:15 3: %%%%%%% Changes from base to side #1 - yostqsxw 7b90c9f6 test.user@example.com 2001-02-03 08:05:15 4: +new text from new commit 1 - yostqsxw 7b90c9f6 test.user@example.com 2001-02-03 08:05:15 5: +++++++ Contents of side #2 - royxmykx b0571bd9 test.user@example.com 2001-02-03 08:05:13 6: new text from new commit 2 - yostqsxw 7b90c9f6 test.user@example.com 2001-02-03 08:05:15 7: >>>>>>> Conflict 1 of 1 ends - "###); + insta::assert_snapshot!(stdout, @r" + qpvuntsm test.use 2001-02-03 08:05:08 1: line1 + yostqsxw test.use 2001-02-03 08:05:15 2: <<<<<<< Conflict 1 of 1 + yostqsxw test.use 2001-02-03 08:05:15 3: %%%%%%% Changes from base to side #1 + yostqsxw test.use 2001-02-03 08:05:15 4: +new text from new commit 1 + yostqsxw test.use 2001-02-03 08:05:15 5: +++++++ Contents of side #2 + royxmykx test.use 2001-02-03 08:05:13 6: new text from new commit 2 + yostqsxw test.use 2001-02-03 08:05:15 7: >>>>>>> Conflict 1 of 1 ends + "); } #[test] @@ -141,8 +144,8 @@ fn test_annotate_merge_one_sided_conflict_resolution() { .unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); - insta::assert_snapshot!(stdout, @r###" - qpvuntsm 8934c772 test.user@example.com 2001-02-03 08:05:08 1: line1 - zsuskuln 712ba14a test.user@example.com 2001-02-03 08:05:11 2: new text from new commit 1 - "###); + insta::assert_snapshot!(stdout, @r" + qpvuntsm test.use 2001-02-03 08:05:08 1: line1 + zsuskuln test.use 2001-02-03 08:05:11 2: new text from new commit 1 + "); }