diff --git a/src/infrastructure/diff/view/PHUIDiffGraphView.php b/src/infrastructure/diff/view/PHUIDiffGraphView.php --- a/src/infrastructure/diff/view/PHUIDiffGraphView.php +++ b/src/infrastructure/diff/view/PHUIDiffGraphView.php @@ -50,7 +50,6 @@ $thread_count = $pos; for ($n = 0; $n < $thread_count; $n++) { - if (empty($threads[$n])) { $line .= ' '; continue; @@ -60,7 +59,7 @@ if ($found) { $line .= ' '; $joins[] = $n; - unset($threads[$n]); + $threads[$n] = false; } else { $line .= 'o'; $found = true; @@ -114,6 +113,7 @@ if ($thread_commit == $parent) { $found = true; $splits[] = $idx; + break; } } diff --git a/src/infrastructure/diff/view/__tests__/PHUIDiffGraphViewTestCase.php b/src/infrastructure/diff/view/__tests__/PHUIDiffGraphViewTestCase.php --- a/src/infrastructure/diff/view/__tests__/PHUIDiffGraphViewTestCase.php +++ b/src/infrastructure/diff/view/__tests__/PHUIDiffGraphViewTestCase.php @@ -45,10 +45,10 @@ '^', '|^', 'o ', - '|^', - '||^', - 'o ', - 'x', + '| ^', + '| |^', + 'o ', + 'x ', ); $this->assertGraph($picture, $graph, pht('Reverse Tree')); @@ -71,7 +71,30 @@ 'x ', ); - $this->assertGraph($picture, $graph, pht('Reverse Tree')); + $this->assertGraph($picture, $graph, pht('Terminated Tree')); + } + + public function testThreeWayGraphJoin() { + $nodes = array( + 'A' => array('D', 'C', 'B'), + 'B' => array('D'), + 'C' => array('B', 'E', 'F'), + 'D' => array(), + 'E' => array(), + 'F' => array(), + ); + + $graph = $this->newGraph($nodes); + $picture = array( + '^', + '||o', + '|o|', + 'x| ||', + ' | x|', + ' | x', + ); + + $this->assertGraph($picture, $graph, pht('Three-Way Tree')); } private function newGraph(array $nodes) {