aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flags.cc3
-rw-r--r--flags.h1
-rw-r--r--func.cc12
-rw-r--r--ninja.cc5
4 files changed, 14 insertions, 7 deletions
diff --git a/flags.cc b/flags.cc
index c292325..daf0c19 100644
--- a/flags.cc
+++ b/flags.cc
@@ -110,6 +110,9 @@ void Flags::Parse(int argc, char** argv) {
} else if (ParseCommandLineOptionWithArg(
"--ignore_dirty",
argv, &i, &ignore_dirty_pattern)) {
+ } else if (ParseCommandLineOptionWithArg(
+ "--no_ignore_dirty",
+ argv, &i, &no_ignore_dirty_pattern)) {
} else if (arg[0] == '-') {
ERROR("Unknown flag: %s", arg);
} else {
diff --git a/flags.h b/flags.h
index 265be38..8c72fa5 100644
--- a/flags.h
+++ b/flags.h
@@ -38,6 +38,7 @@ struct Flags {
bool use_find_emulator;
const char* goma_dir;
const char* ignore_dirty_pattern;
+ const char* no_ignore_dirty_pattern;
const char* ignore_optional_include_pattern;
const char* makefile;
const char* ninja_dir;
diff --git a/func.cc b/func.cc
index dfa9a71..4de6de8 100644
--- a/func.cc
+++ b/func.cc
@@ -523,13 +523,15 @@ static vector<CommandResult*> g_command_results;
bool ShouldStoreCommandResult(StringPiece cmd) {
if (HasWord(cmd, "date") || HasWord(cmd, "echo"))
return false;
- if (g_flags.ignore_dirty_pattern) {
- Pattern pat(g_flags.ignore_dirty_pattern);
- for (StringPiece tok : WordScanner(cmd)) {
- if (pat.Match(tok))
- return false;
+
+ Pattern pat(g_flags.ignore_dirty_pattern);
+ Pattern nopat(g_flags.no_ignore_dirty_pattern);
+ for (StringPiece tok : WordScanner(cmd)) {
+ if (pat.Match(tok) && !nopat.Match(tok)) {
+ return false;
}
}
+
return true;
}
diff --git a/ninja.cc b/ninja.cc
index 575ef1c..8b413d4 100644
--- a/ninja.cc
+++ b/ninja.cc
@@ -765,8 +765,9 @@ void GenerateNinja(const vector<DepNode*>& nodes,
}
static bool ShouldIgnoreDirty(StringPiece s) {
- return (g_flags.ignore_dirty_pattern &&
- Pattern(g_flags.ignore_dirty_pattern).Match(s));
+ Pattern pat(g_flags.ignore_dirty_pattern);
+ Pattern nopat(g_flags.no_ignore_dirty_pattern);
+ return pat.Match(s) && !nopat.Match(s);
}
bool NeedsRegen(double start_time, const string& orig_args) {