Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121955810
DiffusionPreCommitUsesGitLFSHeraldField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 15, 01:33
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jul 17, 01:33 (2 d)
Engine
blob
Format
Raw Data
Handle
27417795
Attached To
rPH Phabricator
DiffusionPreCommitUsesGitLFSHeraldField.php
View Options
<?php
final
class
DiffusionPreCommitUsesGitLFSHeraldField
extends
DiffusionPreCommitContentHeraldField
{
const
FIELDCONST
=
'diffusion.pre.commit.git-lfs'
;
public
function
getHeraldFieldName
()
{
return
pht
(
'Commit uses Git LFS'
);
}
public
function
getFieldGroupKey
()
{
return
DiffusionChangeHeraldFieldGroup
::
FIELDGROUPKEY
;
}
public
function
getHeraldFieldValue
(
$object
)
{
$map
=
$this
->
getAdapter
()->
getDiffContent
(
'+'
);
// At the time of writing, all current Git LFS files begin with this
// line, verbatim:
//
// version https://git-lfs.github.com/spec/v1
//
// ...but we don't try to match the specific version here, in the hopes
// that this might also detect future versions.
$pattern
=
'(^version
\s
*https://git-lfs.github.com/spec/)i'
;
foreach
(
$map
as
$path
=>
$content
)
{
if
(
preg_match
(
$pattern
,
$content
))
{
return
true
;
}
}
return
false
;
}
protected
function
getHeraldFieldStandardType
()
{
return
self
::
STANDARD_BOOL
;
}
}
Event Timeline
Log In to Comment