summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2010-10-23 21:15:35 (GMT)
committerEvan Martin <martine@danga.com>2010-10-23 21:15:35 (GMT)
commit4dda793603766e549c2b3e586cb9e76485493798 (patch)
tree777ce882692ed4acbd417e3c4f4d29f215cf155c
parentbade0e3035d0b8e2f5c2cb37eac62dc0a30e675a (diff)
downloadNinja-4dda793603766e549c2b3e586cb9e76485493798.zip
Ninja-4dda793603766e549c2b3e586cb9e76485493798.tar.gz
Ninja-4dda793603766e549c2b3e586cb9e76485493798.tar.bz2
consider file existence for dirtiness
-rw-r--r--ninja.h2
-rw-r--r--ninja_test.cc8
2 files changed, 9 insertions, 1 deletions
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) {