mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 08:12:40 +01:00
When generating diffs in "arc diff", disable Git config option "diff.suppressBlankEmpty"
Summary: 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: {F6985234} - Applied patch, rediffed the same change, saw "-c diff.suppressBlankEmpty" in "--trace" output and got this sensible diff: {F6985235} Maniphest Tasks: T13432 Differential Revision: https://secure.phabricator.com/D20877
This commit is contained in:
parent
73943d1bc9
commit
cc1ff38843
1 changed files with 14 additions and 2 deletions
|
@ -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 --",
|
||||
$config_options,
|
||||
$base,
|
||||
$head);
|
||||
} else {
|
||||
list($stdout) = $this->execxLocal(
|
||||
"diff {$options} %s --",
|
||||
"%LR diff {$options} %s --",
|
||||
$config_options,
|
||||
$base);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue