src/common/core/corediff.js
function (containerGuid, relativePath) {
                    var usedDiff, path, containerDiff, baseGuids, i, baseDiff, dataKnownInExtension;

                    containerDiff = getNodeByGuid(diffExtension, containerGuid);
                    if (containerDiff === null) {
                        containerDiff = getNodeByGuid(diffBase, containerGuid);
                        usedDiff = diffBase;
                        path = getPathOfGuid(usedDiff, containerGuid);
                    } else {
                        dataKnownInExtension = true;
                        usedDiff = diffExtension;
                        path = getPathOfGuid(usedDiff, containerGuid);
                    }

                    baseGuids = Object.keys(containerDiff.oBaseGuids || {})
                        .concat(Object.keys(containerDiff.ooBaseGuids || {}));

                    for (i = 0; i < baseGuids.length; i += 1) {
                        baseDiff = getPathOfDiff(getNodeByGuid(diffExtension, baseGuids[i]) || {}, relativePath);
                        if (baseDiff.removed === false || typeof baseDiff.movedFrom === 'string') {
                            //the base exists / changed and new at the given path
                            return true;
                        }
                    }

                    if (dataKnownInExtension &&
                        containerDiff.pointer &&
                        typeof containerDiff.pointer.base === 'string') {
                        // the container changed its base
                        return true;
                    }
                    //this parent was fine, so let's go to the next one - except the root, that we do not have to check
                    relativePath = CONSTANTS.PATH_SEP + getRelidFromPath(path) + relativePath;
                    if (getParentPath(path)) {
                        // we should stop before the ROOT
                        return checkContainer(getParentGuid(diffExtension, path), relativePath);
                    }

                    return false;
                }
function (containerGuid, relativePath) {
                    var usedDiff, path, containerDiff, baseGuids, i, baseDiff, dataKnownInExtension;

                    containerDiff = getNodeByGuid(diffExtension, containerGuid);
                    if (containerDiff === null) {
                        containerDiff = getNodeByGuid(diffBase, containerGuid);
                        usedDiff = diffBase;
                        path = getPathOfGuid(usedDiff, containerGuid);
                    } else {
                        dataKnownInExtension = true;
                        usedDiff = diffExtension;
                        path = getPathOfGuid(usedDiff, containerGuid);
                    }

                    baseGuids = Object.keys(containerDiff.oBaseGuids || {})
                        .concat(Object.keys(containerDiff.ooBaseGuids || {}));

                    for (i = 0; i < baseGuids.length; i += 1) {
                        baseDiff = getPathOfDiff(getNodeByGuid(diffExtension, baseGuids[i]) || {}, relativePath);
                        if (baseDiff.removed === false || typeof baseDiff.movedFrom === 'string') {
                            //the base exists / changed and new at the given path
                            return true;
                        }
                    }

                    if (dataKnownInExtension &&
                        containerDiff.pointer &&
                        typeof containerDiff.pointer.base === 'string') {
                        // the container changed its base
                        return true;
                    }
                    //this parent was fine, so let's go to the next one - except the root, that we do not have to check
                    relativePath = CONSTANTS.PATH_SEP + getRelidFromPath(path) + relativePath;
                    if (getParentPath(path)) {
                        // we should stop before the ROOT
                        return checkContainer(getParentGuid(diffExtension, path), relativePath);
                    }

                    return false;
                }
function ( containerGuid , relativePath ) { var usedDiff , path , containerDiff , baseGuids , i , baseDiff , dataKnownInExtension ; containerDiff = getNodeByGuid ( diffExtension , containerGuid ) ; if ( containerDiff === null ) { containerDiff = getNodeByGuid ( diffBase , containerGuid ) ; usedDiff = diffBase ; path = getPathOfGuid ( usedDiff , containerGuid ) ; } else { dataKnownInExtension = true ; usedDiff = diffExtension ; path = getPathOfGuid ( usedDiff , containerGuid ) ; } baseGuids = Object . keys ( containerDiff . oBaseGuids || { } ) . concat ( Object . keys ( containerDiff . ooBaseGuids || { } ) ) ; for ( i = 0 ; i < baseGuids . length ; i += 1 ) { baseDiff = getPathOfDiff ( getNodeByGuid ( diffExtension , baseGuids [ i ] ) || { } , relativePath ) ; if ( baseDiff . removed === false || typeof baseDiff . movedFrom === 'string' ) { //the base exists / changed and new at the given path return true ; } } if ( dataKnownInExtension && containerDiff . pointer && typeof containerDiff . pointer . base === 'string' ) { // the container changed its base return true ; } //this parent was fine, so let's go to the next one - except the root, that we do not have to check relativePath = CONSTANTS . PATH_SEP + getRelidFromPath ( path ) + relativePath ; if ( getParentPath ( path ) ) { // we should stop before the ROOT return checkContainer ( getParentGuid ( diffExtension , path ) , relativePath ) ; } return false ; }
a generic approach to check for complex collisions, when the same path is being created by changes in the base of some container and inside the container by either move or creation also it moves new nodes whenever any of its container changed base - not necessarily able to figure out, so it is safer to reallocate relid in this rare case
a generic approach to check for complex collisions when the same path is being created by changes in the base of some container and inside the container by either move or creation also it moves new nodes whenever any of its container changed base - not necessarily able to figure out so it is safer to reallocate relid in this rare case