Duplicated "source folders" on export and import of the same profile
Description
I was able to reproduce the issue.
Steps to reproduce the behavior:
- Create a new profile.
- Add one directory in "Sources" (I also added repository, but it is probably not needed to reproduce the problem).
- Export profile to JSON (I also changed
new_archive_name, but it is probably not needed). - Import profile from JSON (check both "Override * settings").
- Switch to the old/new profile (as it is reset to default).
- Switch to the "Sources" tab.
- Observe duplicated entry/ies.
Environment
- OS: Linux
- Vorta version: 0.8.12
- Installed from: DNF/RPM
- Borg version: 1.2.7
Was able to replicate this issue, would like to work on this
So, is overriding supposed to completely, "override" the profile, like replacing all the sources currently present with the one in JSON, or is it supposed to add the sources coming from JSON to the current list of sources.
For a scenario different than the one mentioned in the issue:
Exported JSON profile Pr1.json, has a source ~/Desktop/source_1
And a currently present profile Pr1 has a source ~/Desktop/source_2
So after importing 'Pr1.json', is it supposed to add the source from JSON under the new profile, or completely replace the existing sources.
As per current behavior, the new sources get appended to the list of existing sources under a profile upon overriding. Which explains the duplicate entries mentioned in the issue.
So are we just looking to avoid duplicate entries, or completely replace the existing sources under a profile
Override existing settings suggests "all settings" should be overridden. If only "Sources" are threaded the other way (what about "exclusions"? for consistency, the same should be applied to them), e.g. to give a user an ability to add extra "sources" into the existing profiles, there could be an extra import settings to treat is that way.
Nevertheless, I don't know if the aforementioned idea would be useful for anybody, and in my opinion, the default behavior would be to override "all backup settings" (including sources and exclusions).
@m3nu should I work on this