1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Recognize the official "Go" magic regexp for generated code as generated

Summary: See PHI1112. See T784. Although some more general/flexible solution is arriving eventually, adding this rule seems reasonable for now, since it's not a big deal if we remove it later to replace this with some fancier system.

Test Plan: Created a diff with the official Go generated marker, saw the changeset marked as generated.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20237
This commit is contained in:
epriestley 2019-03-01 06:54:32 -08:00
parent 920ab13cfb
commit cc8dda6299

View file

@ -54,6 +54,12 @@ final class DifferentialChangesetEngine extends Phobject {
if (strpos($new_data, '@'.'generated') !== false) { if (strpos($new_data, '@'.'generated') !== false) {
return true; return true;
} }
// See PHI1112. This is the official pattern for marking Go code as
// generated.
if (preg_match('(^// Code generated .* DO NOT EDIT\.$)m', $new_data)) {
return true;
}
} }
return false; return false;