File tree 3 files changed +15
-13
lines changed
3 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -2165,15 +2165,15 @@ fn cookiecutter_globbing() -> Result<()> {
2165
2165
--- {{cookiecutter.repo_name}}/tests/maintest.py
2166
2166
+++ {{cookiecutter.repo_name}}/tests/maintest.py
2167
2167
@@ -1,3 +1,3 @@
2168
- import foo
2169
- import bar
2168
+ import foo
2169
+ import bar
2170
2170
-import foo
2171
2171
/ No newline at end of file
2172
2172
+import foo
2173
2173
2174
2174
2175
2175
----- stderr -----
2176
- warning: Error parsing original glob: `"[TMP]/{{cookiecutter.repo_name}}/tests/*"`, trying with escaped braces (`{}`)
2176
+ warning: Error parsing original glob: `"[TMP]/{{cookiecutter.repo_name}}/tests/*"`, trying with escaped braces: `"[TMP]/[{][{]cookiecutter.repo_name[}][}]/tests/*"`
2177
2177
1 file would be reformatted
2178
2178
"# ) ;
2179
2179
} ) ;
Original file line number Diff line number Diff line change @@ -2729,14 +2729,14 @@ fn cookiecutter_globbing() -> Result<()> {
2729
2729
. args( STDIN_BASE_OPTIONS )
2730
2730
. arg( "--select=F811" )
2731
2731
. current_dir( tempdir. path( ) ) , @r#"
2732
- success: true
2733
- exit_code: 0
2734
- ----- stdout -----
2735
- All checks passed!
2732
+ success: true
2733
+ exit_code: 0
2734
+ ----- stdout -----
2735
+ All checks passed!
2736
2736
2737
- ----- stderr -----
2738
- warning: Error parsing original glob: `"[TMP]/{{cookiecutter.repo_name}}/tests/*"`, trying with escaped braces (`{}`)
2739
- "#) ;
2737
+ ----- stderr -----
2738
+ warning: Error parsing original glob: `"[TMP]/{{cookiecutter.repo_name}}/tests/*"`, trying with escaped braces: `"[TMP]/[{][{]cookiecutter.repo_name[}][}]/tests/*"`
2739
+ "#) ;
2740
2740
} ) ;
2741
2741
2742
2742
// after removing the config file with the ignore, F811 applies, so the glob worked above
Original file line number Diff line number Diff line change @@ -656,9 +656,11 @@ where
656
656
pub fn try_glob_new ( s : & str ) -> Result < Glob > {
657
657
match Glob :: new ( s) {
658
658
Err ( e) if * e. kind ( ) == globset:: ErrorKind :: NestedAlternates => {
659
- log:: warn!( "Error parsing original glob: `{s:?}`, trying with escaped braces (`{{}}`)" ) ;
660
- let s = s. replace ( "{{" , "[{][{]" ) . replace ( "}}" , "[}][}]" ) ;
661
- Ok ( Glob :: new ( & s) ?)
659
+ let new = s. replace ( "{{" , "[{][{]" ) . replace ( "}}" , "[}][}]" ) ;
660
+ log:: warn!(
661
+ "Error parsing original glob: `{s:?}`, trying with escaped braces: `{new:?}`"
662
+ ) ;
663
+ Ok ( Glob :: new ( & new) ?)
662
664
}
663
665
glob => Ok ( glob?) ,
664
666
}
You can’t perform that action at this time.
0 commit comments