Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98117654
DiffusionGitRawDiffQuery.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
Thu, Jan 9, 23:34
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 11, 23:34 (2 d)
Engine
blob
Format
Raw Data
Handle
23509106
Attached To
rPH Phabricator
DiffusionGitRawDiffQuery.php
View Options
<?php
final
class
DiffusionGitRawDiffQuery
extends
DiffusionRawDiffQuery
{
protected
function
newQueryFuture
()
{
$drequest
=
$this
->
getRequest
();
$repository
=
$drequest
->
getRepository
();
$commit
=
$this
->
getAnchorCommit
();
$options
=
array
(
'-M'
,
'-C'
,
'--no-ext-diff'
,
'--no-color'
,
'--src-prefix=a/'
,
'--dst-prefix=b/'
,
'-U'
.(
int
)
$this
->
getLinesOfContext
(),
);
$against
=
$this
->
getAgainstCommit
();
if
(
$against
===
null
)
{
// Check if this is the root commit by seeing if it has parents, since
// `git diff X^ X` does not work if "X" is the initial commit.
list
(
$parents
)
=
$repository
->
execxLocalCommand
(
'log --format=%s %s --'
,
'%P'
,
$commit
);
if
(
strlen
(
trim
(
$parents
)))
{
$against
=
$commit
.
'^'
;
}
else
{
$against
=
ArcanistGitAPI
::
GIT_MAGIC_ROOT_COMMIT
;
}
}
$path
=
$drequest
->
getPath
();
if
(!
strlen
(
$path
))
{
$path
=
'.'
;
}
return
$repository
->
getLocalCommandFuture
(
'diff %Ls %s %s -- %s'
,
$options
,
$against
,
$commit
,
$path
);
}
}
Event Timeline
Log In to Comment