diff --git a/conf/default.conf.php b/conf/default.conf.php index 6ee2c8ea36..19dd22e12b 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -605,6 +605,13 @@ return array( // interact with the revisions. 'differential.anonymous-access' => false, + // List of file regexps that should be treated as if they are generated by + // an automatic process, and thus get hidden by default in differential + 'differential.generated-paths' => array( + // '/config\.h$/', + // '#/autobuilt/#', + ), + // -- Maniphest ------------------------------------------------------------- // diff --git a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php index b1716e25b3..6ec3193481 100644 --- a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php @@ -508,6 +508,17 @@ class DifferentialChangesetParser { $generated_guess = (strpos($new_corpus_block, '@'.'generated') !== false); + if (!$generated_guess) { + $config_key = 'differential.generated-paths'; + $generated_path_regexps = PhabricatorEnv::getEnvConfig($config_key); + foreach ($generated_path_regexps as $regexp) { + if (preg_match($regexp, $this->changeset->getFilename())) { + $generated_guess = true; + break; + } + } + } + $event = new PhabricatorEvent( PhabricatorEventType::TYPE_DIFFERENTIAL_WILLMARKGENERATED, array( diff --git a/src/applications/differential/parser/changeset/__init__.php b/src/applications/differential/parser/changeset/__init__.php index 15d1a09dc3..75f3d0475a 100644 --- a/src/applications/differential/parser/changeset/__init__.php +++ b/src/applications/differential/parser/changeset/__init__.php @@ -15,6 +15,7 @@ phutil_require_module('phabricator', 'applications/differential/view/inlinecomme phutil_require_module('phabricator', 'applications/files/storage/file'); phutil_require_module('phabricator', 'applications/markup/syntax'); phutil_require_module('phabricator', 'infrastructure/diff/engine'); +phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'infrastructure/events/constant/type'); phutil_require_module('phabricator', 'infrastructure/events/event'); phutil_require_module('phabricator', 'infrastructure/javelin/markup');