Generate file attachment transactions for explicit Remarkup attachments on common...
[phabricator.git] / src / applications / diffusion / herald / DiffusionPreCommitUsesGitLFSHeraldField.php
blob3a34db777cee37bc76565bc759a2c9fa3c799f5e
1 <?php
3 final class DiffusionPreCommitUsesGitLFSHeraldField
4 extends DiffusionPreCommitContentHeraldField {
6 const FIELDCONST = 'diffusion.pre.commit.git-lfs';
8 public function getHeraldFieldName() {
9 return pht('Commit uses Git LFS');
12 public function getFieldGroupKey() {
13 return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
16 public function getHeraldFieldValue($object) {
17 $map = $this->getAdapter()->getDiffContent('+');
19 // At the time of writing, all current Git LFS files begin with this
20 // line, verbatim:
22 // version https://git-lfs.github.com/spec/v1
24 // ...but we don't try to match the specific version here, in the hopes
25 // that this might also detect future versions.
26 $pattern = '(^version\s*https://git-lfs.github.com/spec/)i';
28 foreach ($map as $path => $content) {
29 if (preg_match($pattern, $content)) {
30 return true;
34 return false;
37 protected function getHeraldFieldStandardType() {
38 return self::STANDARD_BOOL;