@@ -9,6 +9,7 @@ export interface FileEntry {
99
1010/** Sentinel used to explicitly drop a value. */
1111export const DROP = Symbol ( "MERGE_DROP" ) ;
12+ export const DEFAULT_BACKUP_DIR = ".merge-backups" ;
1213
1314/**
1415 * Checks whether the given file contains Git merge conflict markers.
@@ -44,13 +45,15 @@ export const listMatchingFiles = async ({
4445 matcher,
4546 includeNonConflicted,
4647 debug,
47- backupDir,
48+ backupDir = DEFAULT_BACKUP_DIR ,
4849} : CollectFilesOptions ) : Promise < FileEntry [ ] > => {
4950 for ( const p of [ ...include , ...exclude ] ) {
5051 if ( p . startsWith ( "!" ) ) throw new Error ( `Negation not allowed in include/exclude: ${ p } ` ) ;
5152 if ( p . includes ( "\\" ) ) console . warn ( `Use '/' as path separator: ${ p } ` ) ;
5253 }
5354
55+ exclude . push ( backupDir ) ;
56+
5457 const fileMatcher = ( filepath : string ) => {
5558 const posixPath = filepath . replace ( / \\ / g, "/" ) ;
5659 return matcher . isMatch ( posixPath , include ) && ! matcher . isMatch ( posixPath , exclude ) ;
@@ -149,7 +152,7 @@ export const createSkipDirectoryMatcher = (
149152 } ;
150153} ;
151154
152- export const backupFile = async ( filePath : string , backupDir = ".merge-backups" ) => {
155+ export const backupFile = async ( filePath : string , backupDir : string ) => {
153156 const relPath = path . relative ( process . cwd ( ) , filePath ) ;
154157 const backupPath = path . join ( backupDir , relPath ) ;
155158
0 commit comments