File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,9 +24,10 @@ repos:
2424" } ;
2525
2626static SAMPLE_CONFIG_TOML : & str = indoc:: indoc! { r#"
27- #:schema: https://www.schemastore.org/prek.json
2827# Configuration file for `prek`, a git hook framework written in Rust.
2928# See https://prek.j178.dev for more information.
29+ #:schema https://www.schemastore.org/prek.json
30+ #:tombi toml-version = "v1.1.0"
3031
3132[[repos]]
3233repo = "builtin"
Original file line number Diff line number Diff line change @@ -78,6 +78,14 @@ fn json_to_toml(value: &serde_json::Value) -> Result<String> {
7878 . context ( "Expected a top-level mapping in the config file" ) ?;
7979
8080 let mut doc = DocumentMut :: new ( ) ;
81+ doc. decor_mut ( ) . set_prefix ( indoc:: indoc! { r#"
82+ # Configuration file for `prek`, a git hook framework written in Rust.
83+ # See https://prek.j178.dev for more information.
84+ #:schema https://www.schemastore.org/prek.json
85+ #:tombi toml-version = "v1.1.0"
86+
87+ "# } ) ;
88+
8189 for ( key, value) in map {
8290 if key == "repos" {
8391 let repos = value. as_array ( ) . context ( "`repos` must be an array" ) ?;
Original file line number Diff line number Diff line change @@ -111,9 +111,10 @@ fn sample_config_toml() {
111111 "# ) ;
112112
113113 insta:: assert_snapshot!( context. read( "prek.toml" ) , @r#"
114- #:schema: https://www.schemastore.org/prek.json
115114 # Configuration file for `prek`, a git hook framework written in Rust.
116115 # See https://prek.j178.dev for more information.
116+ #:schema https://www.schemastore.org/prek.json
117+ #:tombi toml-version = "v1.1.0"
117118
118119 [[repos]]
119120 repo = "builtin"
@@ -133,9 +134,10 @@ fn sample_config_format() {
133134 success: true
134135 exit_code: 0
135136 ----- stdout -----
136- #:schema: https://www.schemastore.org/prek.json
137137 # Configuration file for `prek`, a git hook framework written in Rust.
138138 # See https://prek.j178.dev for more information.
139+ #:schema https://www.schemastore.org/prek.json
140+ #:tombi toml-version = "v1.1.0"
139141
140142 [[repos]]
141143 repo = "builtin"
@@ -222,9 +224,10 @@ fn respect_format_if_filename_missing() {
222224 " ) ;
223225
224226 insta:: assert_snapshot!( context. read( "prek.toml" ) , @r#"
225- #:schema: https://www.schemastore.org/prek.json
226227 # Configuration file for `prek`, a git hook framework written in Rust.
227228 # See https://prek.j178.dev for more information.
229+ #:schema https://www.schemastore.org/prek.json
230+ #:tombi toml-version = "v1.1.0"
228231
229232 [[repos]]
230233 repo = "builtin"
Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ fn yaml_to_toml_writes_default_output() -> anyhow::Result<()> {
7979 ) ;
8080
8181 insta:: assert_snapshot!( context. read( PREK_TOML ) , @r#"
82+ # Configuration file for `prek`, a git hook framework written in Rust.
83+ # See https://prek.j178.dev for more information.
84+ #:schema https://www.schemastore.org/prek.json
85+ #:tombi toml-version = "v1.1.0"
86+
8287 fail_fast = true
8388 default_install_hook_types = ["pre-push"]
8489 exclude = """
You can’t perform that action at this time.
0 commit comments