Created
April 18, 2011 06:00
-
-
Save iwadon/924880 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/graph_test.cc b/src/graph_test.cc | |
| index ba41440..ef9fee2 100644 | |
| --- a/src/graph_test.cc | |
| +++ b/src/graph_test.cc | |
| @@ -79,3 +79,28 @@ TEST_F(GraphTest, ExplicitImplicit) { | |
| // the output to be dirty). | |
| EXPECT_TRUE(GetNode("out.o")->dirty_); | |
| } | |
| + | |
| +TEST_F(GraphTest, PathWithCurrentDirectory) { | |
| + ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, | |
| +"rule catdep\n" | |
| +" depfile = $out.d\n" | |
| +" command = cat $in > $out\n" | |
| +"build ./out.o: catdep ./foo.cc\n")); | |
| + fs_.Create("foo.cc", 1, ""); | |
| + fs_.Create("out.o.d", 1, "out.o: foo.cc\n"); | |
| + fs_.Create("out.o", 1, ""); | |
| + | |
| + Edge* edge = GetNode("out.o")->in_edge_; | |
| + Edge* edge2 = GetNode("./out.o")->in_edge_; | |
| + ASSERT_TRUE(edge != NULL); | |
| + ASSERT_TRUE(edge2 != NULL); | |
| + EXPECT_EQ(edge2, edge); | |
| + string err; | |
| + EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); | |
| + ASSERT_EQ("", err); | |
| + EXPECT_TRUE(edge2->RecomputeDirty(&state_, &fs_, &err)); | |
| + ASSERT_EQ("", err); | |
| + | |
| + EXPECT_FALSE(GetNode("out.o")->dirty_); | |
| + EXPECT_FALSE(GetNode("./out.o")->dirty_); | |
| +} | |
| diff --git a/src/ninja_jumble.cc b/src/ninja_jumble.cc | |
| index a935c21..109d9c4 100644 | |
| --- a/src/ninja_jumble.cc | |
| +++ b/src/ninja_jumble.cc | |
| @@ -107,11 +107,17 @@ bool RealDiskInterface::MakeDir(const string& path) { | |
| } | |
| FileStat* StatCache::GetFile(const string& path) { | |
| - Paths::iterator i = paths_.find(path); | |
| + string path2; | |
| + if (path.substr(0, 2) == "./") { | |
| + path2 = path.substr(2); | |
| + } else { | |
| + path2 = path; | |
| + } | |
| + Paths::iterator i = paths_.find(path2); | |
| if (i != paths_.end()) | |
| return i->second; | |
| - FileStat* file = new FileStat(path); | |
| - paths_[path] = file; | |
| + FileStat* file = new FileStat(path2); | |
| + paths_[path2] = file; | |
| return file; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment