From 2c6ae03c3c110f0fbf9fbdcd1b5068775e92aa97 Mon Sep 17 00:00:00 2001 From: Erik Lundgren Date: Mon, 5 Feb 2018 14:53:01 +0100 Subject: [PATCH] fix: Use git directory parent for absolute file paths If you have a package.json file in a non-git-root directory you will get duplicate folders in the path (since diffs are based at the git-root directory). This commit uses git root directory as path base instead of working directory to fix that. fix #3 --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6de96b1..c07a7b7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -110,7 +110,7 @@ export function main( * Read the modified file contents and resolve the relevant formatter. */ const modifiedFile = new ModifiedFile({ - fullPath: join(workingDirectory, filename), + fullPath: join(gitDirectoryParent, filename), gitDirectoryParent, base: options.base, head: options.head,