From db142b668b9aca327a5c8ac98c80834445d2ccda Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Wed, 28 Oct 2020 13:03:22 +0100 Subject: [PATCH] fix: resolve relative paths to staged files This fixes instances where there are staged changes, but they aren't picked up with using the `--staged` flag. After moving to gathering files with absolute paths, we must construct absolute paths for the files reported as changed by Git that were listed as relative. --- src/utils/files.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/files.js b/src/utils/files.js index e6e6657e..423dacd2 100644 --- a/src/utils/files.js +++ b/src/utils/files.js @@ -145,7 +145,10 @@ const stagedFiles = (files = []) => { const output = result.stdout.trim() if (output) { - const staged = output.split('\n') + const staged = output + .split('\n') + .map(f => path.resolve(CONSUMING_ROOT, f)) + return files.filter(f => staged.includes(f)) }