From 3bc25560f76d55a72d7afaaea85297ef14e24f0b Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 7 Apr 2020 18:39:08 +0200 Subject: [PATCH] packages/cli: treat untracked input dirs as dirty --- packages/cli/src/commands/build-cache/cache.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/cli/src/commands/build-cache/cache.ts b/packages/cli/src/commands/build-cache/cache.ts index a6c51671f5..4dddaedc6f 100644 --- a/packages/cli/src/commands/build-cache/cache.ts +++ b/packages/cli/src/commands/build-cache/cache.ts @@ -96,6 +96,10 @@ export class Cache { for (const quotedInputPath of quotedInputPaths) { const output = await runPlain(`git ls-tree HEAD ${quotedInputPath}`); const [, , sha] = output.split(/\s+/, 3); + // If we can't get a tree sha it means we're outside of tracked files, so treat as dirty + if (!sha) { + return undefined; + } trees.push(sha); }