summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-06-19 23:09:50 (GMT)
committerNico Weber <nicolasweber@gmx.de>2014-06-20 14:24:23 (GMT)
commite4be3232d947abb419f2d0ce542b9b70f3343434 (patch)
tree712890c4e99bee907a74213982becc0cae5f3655
parente88a8daa10bb27a0617c74f3bc6eec66823f3a99 (diff)
downloadNinja-e4be3232d947abb419f2d0ce542b9b70f3343434.zip
Ninja-e4be3232d947abb419f2d0ce542b9b70f3343434.tar.gz
Ninja-e4be3232d947abb419f2d0ce542b9b70f3343434.tar.bz2
do not delete files from the logs that still exist on disk
This is to keep the possibility of maybe having a tool that deletes old files in the future, or for having a tool which exposes this information to generators so they can do that. See https://github.com/martine/ninja/pull/697#issuecomment-37140762 and the discussion on #762. Idea from @maximuska!
-rw-r--r--src/ninja.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index e555df4..15e265b 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -147,7 +147,9 @@ struct NinjaMain : public BuildLogUser {
// edge is rare, and the first recompaction will delete all old outputs from
// the deps log, and then a second recompaction will clear the build log,
// which seems good enough for this corner case.)
- return !n || !n->in_edge();
+ // Do keep entries around for files which still exist on disk, for
+ // generators that want to use this information.
+ return (!n || !n->in_edge()) && disk_interface_.Stat(s.AsString()) == 0;
}
};