diff options
author | Nico Weber <nicolasweber@gmx.de> | 2017-02-10 13:14:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-10 13:14:46 -0800 |
commit | 4dc4f1dee9b7aabaea8309d68910285431976e64 (patch) | |
tree | 4dd18e7916125ff37795f905b5ecd3229ae3d48c | |
parent | 2993752dd617ada5218836dd6545fb06690e238b (diff) | |
parent | abcd5f3d4d2ea3f58698fd3abcb7935ba8332f70 (diff) | |
download | ninja-4dc4f1dee9b7aabaea8309d68910285431976e64.tar.gz |
Merge pull request #1237 from danw/no_reload_with_restat
Support restat when rebuilding manifest
-rw-r--r-- | src/ninja.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index 63ec3a8..54de7b9 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -247,10 +247,19 @@ bool NinjaMain::RebuildManifest(const char* input_file, string* err) { if (builder.AlreadyUpToDate()) return false; // Not an error, but we didn't rebuild. - // Even if the manifest was cleaned by a restat rule, claim that it was - // rebuilt. Not doing so can lead to crashes, see - // https://github.com/ninja-build/ninja/issues/874 - return builder.Build(err); + if (!builder.Build(err)) + return false; + + // The manifest was only rebuilt if it is now dirty (it may have been cleaned + // by a restat). + if (!node->dirty()) { + // Reset the state to prevent problems like + // https://github.com/ninja-build/ninja/issues/874 + state_.Reset(); + return false; + } + + return true; } Node* NinjaMain::CollectTarget(const char* cpath, string* err) { |