diff --git a/src/difference/ArcanistDiffUtils.php b/src/difference/ArcanistDiffUtils.php --- a/src/difference/ArcanistDiffUtils.php +++ b/src/difference/ArcanistDiffUtils.php @@ -151,6 +151,7 @@ ->setReplaceCost(2) ->setMaximumLength($max) ->setSequences($ov, $nv) + ->setApplySmoothing(true) ->getEditString(); } @@ -167,25 +168,6 @@ $result = self::generateEditString($ov, $nv); - // Smooth the string out, by replacing short runs of similar characters - // with 'x' operations. This makes the result more readable to humans, since - // there are fewer choppy runs of short added and removed substrings. - do { - $original = $result; - $result = preg_replace( - '/([xdi])(s{3})([xdi])/', - '$1xxx$3', - $result); - $result = preg_replace( - '/([xdi])(s{2})([xdi])/', - '$1xx$3', - $result); - $result = preg_replace( - '/([xdi])(s{1})([xdi])/', - '$1x$3', - $result); - } while ($result != $original); - // Now we have a character-based description of the edit. We need to // convert into a byte-based description. Walk through the edit string and // adjust each operation to reflect the number of bytes in the underlying diff --git a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php --- a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php +++ b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php @@ -60,12 +60,12 @@ array( 'abcdefg', 'abxdxfg', - 'ssxsxss', + 'ssxxxss', ), array( 'private function a($a, $b) {', 'public function and($b, $c) {', - 'siixsdddxsssssssssssiissxsssxsss', + 'siixxdddxsssssssssssiixxxxxxxsss', ), array(