Skip to content

Add user settings before defaults #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 36 additions & 31 deletions src/Core/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,17 @@ public class Main : GLib.Object{

var list = new Gee.ArrayList<string>();

// add user entries from current setting
// user entry is first since rsync prioritizes the first
// inclusion/exclusion patterns seen
// -------------------------------------------------------

foreach(string path in exclude_list_user){
if (!list.contains(path)){
list.add(path);
}
}

// add default entries ---------------------------

foreach(string path in exclude_list_default){
Expand Down Expand Up @@ -780,14 +791,6 @@ public class Main : GLib.Object{
}
}

// add user entries from current settings ----------

foreach(string path in exclude_list_user){
if (!list.contains(path)){
list.add(path);
}
}

// add common entries for excluding home folders for all users --------

foreach(string path in exclude_list_home){
Expand All @@ -812,6 +815,31 @@ public class Main : GLib.Object{

exclude_list_restore.clear();

//add user entries from current settings
//user entry is first since rsync prioritizes the first
//inclusion/exclusion patterns seen
foreach(string path in exclude_list_user){

// skip include filters for restore
if (path.strip().has_prefix("+")){ continue; }

if (!exclude_list_restore.contains(path) && !exclude_list_home.contains(path)){
exclude_list_restore.add(path);
}
}

//add user entries from snapshot exclude list
if (snapshot_to_restore != null){
string list_file = path_combine(snapshot_to_restore.path, "exclude.list");
if (file_exists(list_file)){
foreach(string path in file_read(list_file).split("\n")){
if (!exclude_list_restore.contains(path) && !exclude_list_home.contains(path)){
exclude_list_restore.add(path);
}
}
}
}

//add default entries
foreach(string path in exclude_list_default){
if (!exclude_list_restore.contains(path)){
Expand Down Expand Up @@ -839,29 +867,6 @@ public class Main : GLib.Object{
}
}

//add user entries from current settings
foreach(string path in exclude_list_user){

// skip include filters for restore
if (path.strip().has_prefix("+")){ continue; }

if (!exclude_list_restore.contains(path) && !exclude_list_home.contains(path)){
exclude_list_restore.add(path);
}
}

//add user entries from snapshot exclude list
if (snapshot_to_restore != null){
string list_file = path_combine(snapshot_to_restore.path, "exclude.list");
if (file_exists(list_file)){
foreach(string path in file_read(list_file).split("\n")){
if (!exclude_list_restore.contains(path) && !exclude_list_home.contains(path)){
exclude_list_restore.add(path);
}
}
}
}

//add home entries
foreach(string path in exclude_list_home){
if (!exclude_list_restore.contains(path)){
Expand Down