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
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)) {
37 protected function getHeraldFieldStandardType() {
38 return self
::STANDARD_BOOL
;