Commit cc1ff388 authored by epriestley's avatar epriestley

When generating diffs in "arc diff", disable Git config option "diff.suppressBlankEmpty"

Ref T13432. Git has a "diff.suppressBlankEmpty" config option which makes it emit nonstandard diffs with trimmed trailing whitespace on unchanged blank lines.

Currently, we don't parse these diffs correctly. Even if we do in the future, emitting a more standard diff is desirable.

Explicitly disable this option when executing "git diff" so we build more standard diffs.

Test Plan:
  - Configured this option.
  - Modified a file with a blank line in it without changing the blank line, got this goofy display diff:


  - Applied patch, rediffed the same change, saw "-c diff.suppressBlankEmpty" in "--trace" output and got this sensible diff:


Maniphest Tasks: T13432

Differential Revision:
parent 73943d1b
......@@ -464,15 +464,27 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
public function getFullGitDiff($base, $head = null) {
$options = $this->getDiffFullOptions();
$config_options = array();
// See T13432. Disable the rare "diff.suppressBlankEmpty" configuration
// option, which discards the " " (space) change type prefix on unchanged
// blank lines. At time of writing the parser does not handle these
// properly, but generating a more-standard diff is generally desirable
// even if a future parser handles this case more gracefully.
$config_options[] = '-c';
$config_options[] = 'diff.suppressBlankEmpty=false';
if ($head !== null) {
list($stdout) = $this->execxLocal(
"diff {$options} %s %s --",
"%LR diff {$options} %s %s --",
} else {
list($stdout) = $this->execxLocal(
"diff {$options} %s --",
"%LR diff {$options} %s --",
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment