From 06f488a8f61febb82aa8c9a99657cf86a187e058 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 21 May 2024 20:24:48 +0900 Subject: [PATCH] cli: config: update default template for multi-line overridden values --- cli/src/config/templates.toml | 10 +++------- cli/tests/test_config_command.rs | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/cli/src/config/templates.toml b/cli/src/config/templates.toml index f057424a7..7a746d074 100644 --- a/cli/src/config/templates.toml +++ b/cli/src/config/templates.toml @@ -15,13 +15,9 @@ if(remote, commit_summary = 'format_commit_summary_with_refs(self, branches)' config_list = ''' -label(if(overridden, "overridden"), - concat( - if(overridden, "# "), - name, - "=", - value, - ), +if(overridden, + label("overridden", indent("# ", name ++ "=" ++ value)), + name ++ "=" ++ value, ) ++ "\n" ''' diff --git a/cli/tests/test_config_command.rs b/cli/tests/test_config_command.rs index 94ef5e591..577086d42 100644 --- a/cli/tests/test_config_command.rs +++ b/cli/tests/test_config_command.rs @@ -156,6 +156,24 @@ bar bar """ "###); + + let stdout = test_env.jj_cmd_success( + test_env.env_root(), + &[ + "config", + "list", + "multiline", + "--include-overridden", + "--config-toml=multiline='single'", + ], + ); + insta::assert_snapshot!(stdout, @r###" + # multiline=""" + # foo + # bar + # """ + multiline="single" + "###); } #[test]