diff --git a/src/config/templates.toml b/src/config/templates.toml index a0325eb55..dace130d0 100644 --- a/src/config/templates.toml +++ b/src/config/templates.toml @@ -7,11 +7,8 @@ separate(" ", ''' log = 'builtin_log_compact' - op_log = 'builtin_op_log_compact' - -# Defined as alias to allow 'log -T show' -show = 'show' +show = 'builtin_log_detailed' [template-aliases] 'builtin_log_oneline' = '''label(if(current_working_copy, "working_copy"), @@ -61,6 +58,18 @@ show = 'show' ) ''' builtin_log_comfortable = 'builtin_log_compact ++ "\n"' +# TODO: Add branches, tags, etc +'builtin_log_detailed' = ''' +concat( + "Commit ID: " ++ commit_id ++ "\n", + "Change ID: " ++ change_id ++ "\n", + "Author: " ++ author ++ " (" ++ format_timestamp(author.timestamp()) ++ ")\n", + "Committer: " ++ committer ++ " (" ++ format_timestamp(committer.timestamp()) ++ ")\n", + "\n", + indent(" ", if(description, description, description_placeholder ++ "\n")), + "\n", +) +''' builtin_op_log_compact = ''' label(if(current_operation, "current_operation"), @@ -87,16 +96,3 @@ builtin_op_log_comfortable = 'builtin_op_log_compact ++ "\n"' 'format_time_range(time_range)' = ''' time_range.start().ago() ++ label("time", ", lasted ") ++ time_range.duration()''' 'format_timestamp(timestamp)' = 'timestamp' - -# TODO: Add branches, tags, etc -'show' = ''' -concat( - "Commit ID: " ++ commit_id ++ "\n", - "Change ID: " ++ change_id ++ "\n", - "Author: " ++ author ++ " (" ++ format_timestamp(author.timestamp()) ++ ")\n", - "Committer: " ++ committer ++ " (" ++ format_timestamp(committer.timestamp()) ++ ")\n", - "\n", - indent(" ", if(description, description, description_placeholder ++ "\n")), - "\n", -) -''' diff --git a/tests/test_commit_template.rs b/tests/test_commit_template.rs index 0a35a9415..40a54edd6 100644 --- a/tests/test_commit_template.rs +++ b/tests/test_commit_template.rs @@ -182,6 +182,23 @@ fn test_log_builtin_templates() { (empty) (no description set) "###); + + insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r###" + @ Commit ID: 230dd059e1b059aefc0da06a2e5a7dbf22362f22 + │ Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu + │ Author: Test User (2001-02-03 04:05:07.000 +07:00) + │ Committer: Test User (2001-02-03 04:05:07.000 +07:00) + │ + │ (no description set) + │ + ◉ Commit ID: 0000000000000000000000000000000000000000 + Change ID: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + Author: <> (1970-01-01 00:00:00.000 +00:00) + Committer: <> (1970-01-01 00:00:00.000 +00:00) + + (no description set) + + "###); } #[test]