From 38c4bcad55ce1e8203e5507b6db2700120688aae Mon Sep 17 00:00:00 2001
From: Meik Sievertsen <acydburn@phpbb.com>
Date: Fri, 18 Sep 2009 18:18:54 +0000
Subject: Ok, after 20+ hours i think i fixed all grave issues with the updater
 - smaller memory footprint - better checks for already updated files - even
 less conflicts - fixed automatic conflict resolving after successful merges -
 no more conflicts for $Id$ changes - fixed skip_whitespace_changes bug where
 code blocks were added to diff_op_add whereby the previous or next
 diff_op_copy already had the change - correctly display merged files in diff
 view (previously it happened that the old file was used for comparision,
 although the new file was different/newer/merged)

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10163 89ea8834-ac86-4346-8a33-228a782c2dd0
---
 phpBB/includes/diff/engine.php | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

(limited to 'phpBB/includes/diff/engine.php')

diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php
index da7b4344a3..982149457d 100644
--- a/phpBB/includes/diff/engine.php
+++ b/phpBB/includes/diff/engine.php
@@ -145,8 +145,21 @@ class diff_engine
 		$this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
 
 		// Merge edits when possible.
-		$this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
-		$this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
+		if ($this->skip_whitespace_changes)
+		{
+			$from_lines_clean = array_map('trim', $from_lines);
+			$to_lines_clean = array_map('trim', $to_lines);
+
+			$this->_shift_boundaries($from_lines_clean, $this->xchanged, $this->ychanged);
+			$this->_shift_boundaries($to_lines_clean, $this->ychanged, $this->xchanged);
+
+			unset($from_lines_clean, $to_lines_clean);
+		}
+		else
+		{
+			$this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
+			$this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
+		}
 
 		// Compute the edit operations.
 		$edits = array();
-- 
cgit v1.2.1