I use a Git repository to sync DOpus settings across two Windows 11 computers. [1]
I found that in some config files the order of XML items changes regularly. Thus, Git indicates there was a change, while all what happened was that DOpus reordered the XML entries.
For example, in /dopusdata/Formats/wild.off, the structure is:
It’s frequent that DOpus switches the order of path 1 and path2, while the content of the path items remains unchanged. That’s a problem as I regularly have to commit “DOpus reordered entries”. Another example is /dopusdata/ConfigFiles/evalfilegroups.xml, see screenshot below.
Do you have any ideas why this happens? Different library versions? Data structures with non-deterministic/undefined ordering?
I’d be nice of XML content could be sorted in some way before being written to the config file.
Interesting. I’m using DOpus on two devices and I’m not sure yet whether it’s an issue that only occurs across devices or also on a single device - that’s why I asked about possibly different libraries (I think DOpus doesn’t use .net, does it?). I’m using the same DOpus version on both devices.
Here’s another example where 2 lines were re-ordered to another line by DOpus in prefs.oxc:
Did you make other changes affecting the files?
Or maybe done things like copy/paste a button to then change one of the two to something else?
I also have my whole dopusdata folder under git but I can't remember seeing things like this.
Most of the files (e.g. other than recent files, state, ...) do not change by themsleves, and even when changing because of a user action (e.g. adding a button to a toolbar), the change is only affecting the part that changed.
No to both. It seems to happen without making any other changes that could explain the behavior.
That’s exactly my assumption as well. Data structures might be involved that come with an undefined/non-deterministic sort order, e.g. hash tables or key:value maps. I also assume it only happens when using DOpus on different devices. Btw, one has an Intel CPU and one an AMD, in case that might matter.
That’s why I suggested to apply some kind of unique “sorting” before saving the XML file.
Now, when I open DOpus Preferences, navigate to Preferences / File Display Columns / Evaluator Groups, make no changes at all, and click “Ok” to close preferences, those lines toggle:
Thanks for the examples. All of those should be in a fixed order once re-saved by the next beta. (You may still see the order change the first time it re-saves a file.)
Small detail: based on @Leo’s explanation, I suppose Git may still indicate there was a change, as it seems like Opus will still re-save - IF Git looks at last change date rather than comparing content. But that’s probably okay for you.
Opus won't usually write out a config file if the contents haven't changed. There's a check for that. So the date shouldn't change unless something in the file does.
AFAIK Git doesn't care about dates on local files other than to know if they might have been modified. It checks the content to see if they really were modified, and the server stores the commit dates rather than the original file dates. (At least, that's how every other source control I've used worked.)