From f4222b3c8b8e01a28113085e12ca3f57b1974882 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 15 Nov 2012 15:47:43 -0800 Subject: [PATCH] Revert "accommodate git's diff.suppress-blank-empty=true setting (D3963)" Summary: Reverts D3963, which is obsoleted by D3969. Test Plan: Straight revert. Reviewers: vrana, jiiix, btrahan Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D3970 --- src/repository/api/ArcanistGitAPI.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 435c45e9..1158f896 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -260,14 +260,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { return $this->relativeCommit; } - private function getDiffFullCommand($detect_moves_and_renames = true) { - $diff_cmd = array( - // Our diff parser relies on the trailing spaces that are suppressed - // when the diff.suppress-blank-empty boolean is set to "true". - // Without the following, "arc lint" would always fail with this: - // "Diff Parse Exception: Found the wrong number of hunk lines." - '-c diff.suppress-blank-empty=false', - 'diff', + private function getDiffFullOptions($detect_moves_and_renames = true) { + $options = array( self::getDiffBaseOptions(), '--no-color', '--src-prefix=a/', @@ -276,11 +270,11 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { ); if ($detect_moves_and_renames) { - $diff_cmd[] = '-M'; - $diff_cmd[] = '-C'; + $options[] = '-M'; + $options[] = '-C'; } - return implode(' ', $diff_cmd); + return implode(' ', $options); } private function getDiffBaseOptions() { @@ -298,9 +292,9 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { } public function getFullGitDiff() { - $diff_cmd = $this->getDiffFullCommand(); + $options = $this->getDiffFullOptions(); list($stdout) = $this->execxLocal( - "{$diff_cmd} %s --", + "diff {$options} %s --", $this->getRelativeCommit()); return $stdout; } @@ -312,9 +306,9 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { * generate real diff text. */ public function getRawDiffText($path, $detect_moves_and_renames = true) { - $diff_cmd = $this->getDiffFullCommand($detect_moves_and_renames); + $options = $this->getDiffFullOptions($detect_moves_and_renames); list($stdout) = $this->execxLocal( - "{$diff_cmd} %s -- %s", + "diff {$options} %s -- %s", $this->getRelativeCommit(), $path); return $stdout; -- 2.43.0