GithubHelp home page GithubHelp logo

Comments (4)

kamsar avatar kamsar commented on July 19, 2024

I'll take a look when I get a chance. Thanks for the clear problem statement :)

from unicorn.

kamsar avatar kamsar commented on July 19, 2024

Hi Kevin,

I'm having trouble reproducing this issue. I set up an example tree like you had:
image

I serialized all of those items.

Then I set my predicate configuration to this:
<include database="master" path="/sitecore/templates/Sites/Configuration"> <exclude path="/sitecore/templates/Sites/Configuration/Online Services" /> </include>

Next I deleted the ignored items from the disk (Online Services and its children) and ran a sync. As expected, the sync worked correctly.

Then, following your steps, I deleted the Configuration folder from the file system and then ran a sync. It seems like in your case Unicorn deleted both Specifications and Online Services items during the sync. In my case, it only deleted Specifications.

The loader does evaluate both the source data and the serialized data when evaluating orphans, as seen in this excerpt from SerializationLoader.cs (185-203):

// get the corresponding item from Sitecore
ISourceItem rootItem = SourceDataProvider.GetItemById(rootSerializedItem.DatabaseName, rootSerializedItem.Id);

// we add all of the root item's direct children to the "maybe orphan" list (we'll remove them as we find matching serialized children)
if (rootItem != null)
{
    var rootChildren = rootItem.Children;
    foreach (ISourceItem child in rootChildren)
    {
        // if the preset includes the child add it to the orphan-candidate list (if we don't deserialize it below, it will be marked orphan)
       // [ADDED] Here is where source items that are excluded (e.g. this example) are removed from the list of items to possibly delete
        var included = Predicate.Includes(child);
        if (included.IsIncluded)
            orphanCandidates[child.Id] = child;
        else
        {
            Logger.SkippedItem(child, Predicate.GetType().Name, included.Justification ?? string.Empty);
        }
    }
}

Am I missing something on reproducing this?

from unicorn.

kevinbrechbuehl avatar kevinbrechbuehl commented on July 19, 2024

Hi Kam,

thanks for looking into this. When you delete the Configuration folder from the disk, can you try to also delete the Specifications folder in Sitecore? Then run a sync. The sync fails, if I have on the disk only the Configuration.item (as you also have) and in Sitecore only the folder Configuration with it's child Online Services (but without the Specifications).

It seems that it only doesn't work if the excluded path item (Online Services) is the only child of an item included in the sync (Configuration).

from unicorn.

kamsar avatar kamsar commented on July 19, 2024

Hi Kevin,

I was able to reproduce the issue and have fixed it in version 2.0.2 that is on NuGet now :)

Let me know if it doesn't work for you.

from unicorn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.