From 4dda793603766e549c2b3e586cb9e76485493798 Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Sat, 23 Oct 2010 14:15:35 -0700 Subject: [PATCH] consider file existence for dirtiness --- ninja.h | 2 ++ ninja_test.cc | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ninja.h b/ninja.h index 02bfd59..d7f4108 100644 --- a/ninja.h +++ b/ninja.h @@ -137,6 +137,8 @@ void Edge::RecomputeDirty(StatHelper* stat_helper) { if ((*i)->file_->StatIfNecessary(stat_helper)) { if (Edge* edge = (*i)->in_edge_) edge->RecomputeDirty(stat_helper); + else + (*i)->dirty_ = !(*i)->file_->exists(); } if ((*i)->dirty_) dirty = true; diff --git a/ninja_test.cc b/ninja_test.cc index cba3407..a00cfd9 100644 --- a/ninja_test.cc +++ b/ninja_test.cc @@ -190,7 +190,13 @@ struct BuildTest : public StateTestWithBuiltinRules, }; void BuildTest::Dirty(const string& path) { - GetNode(path)->MarkDirty(); + Node* node = GetNode(path); + node->MarkDirty(); + + // If it's an input file, mark that we've already stat()ed it and + // it's missing. + if (!node->in_edge_) + node->file_->mtime_ = 0; } void BuildTest::Touch(const string& path) { -- 2.7.4