File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1- import { join } from "path" ;
1+ import { isAbsolute , join , relative , sep } from "path" ;
22
33import { getModifiedFilenames , resolveNearestGitDirectoryParent } from "./git-utils" ;
44import { NO_LINE_CHANGE_DATA_ERROR , generateFilesWhitelistPredicate } from "./utils" ;
@@ -76,6 +76,10 @@ export function main(
7676 options . base ,
7777 options . head
7878 )
79+ . map ( path => join ( gitDirectoryParent , path ) )
80+ . map ( path => relative ( workingDirectory , path ) )
81+ . filter ( path => ! isAbsolute ( path ) )
82+ . filter ( path => path !== ".." && ! path . startsWith ( `..${ sep } ` ) )
7983 . filter ( selectedFormatter . hasSupportedFileExtension )
8084 . filter ( generateFilesWhitelistPredicate ( options . filesWhitelist ) )
8185 . filter ( selectedFormatter . generateIgnoreFilePredicate ( workingDirectory ) ) ;
@@ -93,7 +97,7 @@ export function main(
9397 * Read the modified file contents and resolve the relevant formatter.
9498 */
9599 const modifiedFile = new ModifiedFile ( {
96- fullPath : join ( gitDirectoryParent , filename ) ,
100+ fullPath : join ( workingDirectory , filename ) ,
97101 gitDirectoryParent,
98102 base : options . base ,
99103 head : options . head ,
You can’t perform that action at this time.
0 commit comments