1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Use git diff a b for ranges, not git diff a..b

Summary:
These are documented as being identical, but `git diff a b` works if `a` is a tree (for example, `4b825d...`, the empty tree hash), but `git diff a..b` does not.

Particularly, with the `a..b` form, `arc diff --base arc:empty` does not work. With the `a b` form, it does.

Test Plan: Ran `arc diff --base arc:empty` in a repository and got a diff.

Reviewers: btrahan, talshiri

Reviewed By: talshiri

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9898
This commit is contained in:
epriestley 2014-07-11 10:45:11 -07:00
parent 09cf64bec3
commit f9f2092246

View file

@ -429,17 +429,20 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
* @param head revision. If this is null, the generated diff will include the * @param head revision. If this is null, the generated diff will include the
* working copy * working copy
*/ */
public function getFullGitDiff($base, $head=null) { public function getFullGitDiff($base, $head = null) {
$options = $this->getDiffFullOptions(); $options = $this->getDiffFullOptions();
$diff_revision = $base; if ($head !== null) {
if ($head) { list($stdout) = $this->execxLocal(
$diff_revision .= '..'.$head; "diff {$options} %s %s --",
} $base,
$head);
} else {
list($stdout) = $this->execxLocal( list($stdout) = $this->execxLocal(
"diff {$options} %s --", "diff {$options} %s --",
$diff_revision); $base);
}
return $stdout; return $stdout;
} }