Merge pull request #1237 from danw/no_reload_with_restat

Support restat when rebuilding manifest
This commit is contained in:
Nico Weber 2017-02-10 13:14:46 -08:00 committed by GitHub
commit 4dc4f1dee9

View File

@ -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) {