Differential D21510 Diff 51196 src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php
Show All 19 Lines | protected function newQueryFuture() { | ||||
$against = $this->getAgainstCommit(); | $against = $this->getAgainstCommit(); | ||||
if ($against === null) { | if ($against === null) { | ||||
// Check if this is the root commit by seeing if it has parents, since | // 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. | // `git diff X^ X` does not work if "X" is the initial commit. | ||||
list($parents) = $repository->execxLocalCommand( | list($parents) = $repository->execxLocalCommand( | ||||
'log -n 1 --format=%s %s --', | 'log -n 1 --format=%s %s --', | ||||
'%P', | '%P', | ||||
$commit); | gitsprintf('%s', $commit)); | ||||
if (strlen(trim($parents))) { | if (strlen(trim($parents))) { | ||||
$against = $commit.'^'; | $against = $commit.'^'; | ||||
} else { | } else { | ||||
$against = ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT; | $against = ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT; | ||||
} | } | ||||
} | } | ||||
$path = $drequest->getPath(); | $path = $drequest->getPath(); | ||||
if (!strlen($path)) { | if (!strlen($path)) { | ||||
$path = '.'; | $path = '.'; | ||||
} | } | ||||
return $repository->getLocalCommandFuture( | return $repository->getLocalCommandFuture( | ||||
'diff %Ls %s %s -- %s', | 'diff %Ls %s %s -- %s', | ||||
$options, | $options, | ||||
$against, | gitsprintf('%s', $against), | ||||
$commit, | gitsprintf('%s', $commit), | ||||
$path); | $path); | ||||
} | } | ||||
} | } |