mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
Files can be set not to use 'ignore-all' by default.
Summary: Python people don't seem to like the 'ignore-all' as default. Provide a way to configure which file types should not use 'ignore-all'. Test Plan: Tested that it worked with bunch of Python of files and non-python files. Cache was disabled during the test. Reviewed By: jungejason Reviewers: epriestley, jungejason Commenters: epriestley CC: aran, jungejason, epriestley Differential Revision: 713
This commit is contained in:
parent
29e3a7dae3
commit
e00fae8436
4 changed files with 22 additions and 1 deletions
|
@ -416,6 +416,12 @@ return array(
|
|||
// DifferentialCommitMessageModifier
|
||||
'differential.modify-commit-message-class' => null,
|
||||
|
||||
// List of file regexps were whitespace is meaningful and should not
|
||||
// use 'ignore-all' by default
|
||||
'differential.whitespace-matters' => array(
|
||||
'/\.py$/',
|
||||
),
|
||||
|
||||
|
||||
// -- Maniphest ------------------------------------------------------------- //
|
||||
|
||||
|
|
|
@ -767,6 +767,10 @@ class DifferentialChangesetParser {
|
|||
|
||||
$ignore_all = ($this->whitespaceMode == self::WHITESPACE_IGNORE_ALL);
|
||||
|
||||
if ($ignore_all && $changeset->getWhitespaceMatters()) {
|
||||
$ignore_all = false;
|
||||
}
|
||||
|
||||
// The "ignore all whitespace" algorithm depends on rediffing the
|
||||
// files, and we currently need complete representations of both
|
||||
// files to do anything reasonable. If we only have parts of the files,
|
||||
|
|
|
@ -184,4 +184,15 @@ class DifferentialChangeset extends DifferentialDAO {
|
|||
return 80;
|
||||
}
|
||||
|
||||
public function getWhitespaceMatters() {
|
||||
$config = PhabricatorEnv::getEnvConfig('differential.whitespace-matters');
|
||||
foreach ($config as $regexp) {
|
||||
if (preg_match($regexp, $this->getFileName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
|
|||
));
|
||||
|
||||
$options = array(
|
||||
'ignore-all' => 'Ignore All',
|
||||
'ignore-all' => 'Ignore Most',
|
||||
'ignore-trailing' => 'Ignore Trailing',
|
||||
'show-all' => 'Show All',
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue