diff --git a/.gitignore b/.gitignore index 37a8049e2..154280d0d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ __pycache__ # The parse perf test repo /tree + +.vscode diff --git a/src/please.go b/src/please.go index 5eda69dfe..9757c5024 100644 --- a/src/please.go +++ b/src/please.go @@ -508,6 +508,12 @@ var buildFunctions = map[string]func() int{ } if opts.Hash.Update { hashes.RewriteHashes(state, state.ExpandOriginalLabels()) + } else { + // The code above will build the target(s) and unconditionally write to + // the cache. If we're not updating the hash, we need to clear the target(s) + // from the cache again to ensure that future builds depending on the + // target(s) are not able to proceed despite a potentially mismatched hash. + clean.Targets(state, state.ExpandOriginalLabels()) } } return toExitCode(success, state)