File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 66*/
77
88import { join } from "path/mod.ts" ;
9- import { exists } from "fs/mod.ts" ;
9+ import { exists , walkSync } from "fs/mod.ts" ;
1010
1111import { which } from "../core/path.ts" ;
1212import { execProcess } from "../core/process.ts" ;
@@ -15,7 +15,7 @@ import { kQuartoScratch } from "./project-scratch.ts";
1515import { lines } from "../core/text.ts" ;
1616import { isEnvDir } from "../core/jupyter/capabilities.ts" ;
1717
18- export const kQuartoIgnore = [ `/${ kQuartoScratch } /` , `/_*.local` ] ;
18+ export const kQuartoIgnore = [ `/${ kQuartoScratch } /` ] ;
1919
2020export async function ensureGitignore (
2121 dir : string ,
@@ -32,6 +32,17 @@ export async function ensureGitignore(
3232 requiredEntries . push ( requiredEntry ) ;
3333 }
3434 }
35+ // see if we need to gitignore any .local files
36+ const kLocalEntry = `/_*.local` ;
37+ if ( ! gitignore . includes ( kLocalEntry ) ) {
38+ for ( const walk of walkSync ( dir , { maxDepth : 1 } ) ) {
39+ if ( walk . name . match ( / ^ _ .* ?\. l o c a l $ / ) ) {
40+ requiredEntries . push ( kLocalEntry ) ;
41+ break ;
42+ }
43+ }
44+ }
45+
3546 if ( requiredEntries . length > 0 ) {
3647 writeGitignore ( dir , gitignore . concat ( requiredEntries ) ) ;
3748 return true ;
You can’t perform that action at this time.
0 commit comments