From 05108efdfacebb1ee291b650539ee683e5a2aeeb Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 12 Apr 2016 09:44:08 +0200 Subject: [PATCH] correct chainpad's transformation function addresses RTCHAINPAD-3 Pending further testing, this change will still need to be corrected in https://github.com/xwiki-contrib/chainpad/ --- www/common/chainpad.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/chainpad.js b/www/common/chainpad.js index 502e502ab..071c595e8 100644 --- a/www/common/chainpad.js +++ b/www/common/chainpad.js @@ -223,7 +223,10 @@ var transform = Patch.transform = function (origToTransform, transformBy, doc, t toTransform = clone(origToTransform); var text = doc; for (var i = toTransform.operations.length-1; i >= 0; i--) { - text = Operation.apply(toTransform.operations[i], text); + /* this line caused diffs to be applied against the incorrect text + which resulted in bad merges that weren't noticeable until we + tried to patch json. */ + //text = Operation.apply(toTransform.operations[i], text); for (var j = transformBy.operations.length-1; j >= 0; j--) { toTransform.operations[i] = Operation.transform(text, toTransform.operations[i],