update complex logic for config
This commit is contained in:
parent
17708359a1
commit
421b43d937
@ -203,17 +203,17 @@ export const checkIsSkipItemOrNotByName = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isInsideObsFolder(key, configDir) && finalIsIgnored === undefined) {
|
if (isInsideObsFolder(key, configDir) && finalIsIgnored === undefined) {
|
||||||
if(syncConfigDir){
|
if (syncConfigDir) {
|
||||||
finalIsIgnored = false;
|
finalIsIgnored = false;
|
||||||
} else{
|
} else {
|
||||||
finalIsIgnored = true;
|
finalIsIgnored = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBookmarksFile(key, configDir) && finalIsIgnored === undefined) {
|
if (isBookmarksFile(key, configDir) && finalIsIgnored === undefined) {
|
||||||
if(syncBookmarks){
|
if (syncBookmarks) {
|
||||||
finalIsIgnored = false;
|
finalIsIgnored = false;
|
||||||
} else{
|
} else {
|
||||||
finalIsIgnored = true;
|
finalIsIgnored = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -629,15 +629,37 @@ const getSyncPlanInplace = async (
|
|||||||
mixedEntry.change = false;
|
mixedEntry.change = false;
|
||||||
keptFolder.add(getParentFolder(key));
|
keptFolder.add(getParentFolder(key));
|
||||||
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
||||||
|
if (
|
||||||
|
key === `${configDir}/` ||
|
||||||
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian folder!
|
||||||
|
mixedEntry.decisionBranch = 137;
|
||||||
|
mixedEntry.decision = "folder_existed_both_then_do_nothing";
|
||||||
|
mixedEntry.change = false;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
|
} else {
|
||||||
mixedEntry.decisionBranch = 135;
|
mixedEntry.decisionBranch = 135;
|
||||||
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
||||||
mixedEntry.change = true;
|
mixedEntry.change = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// bidirectional
|
// bidirectional
|
||||||
|
if (
|
||||||
|
key === `${configDir}/` ||
|
||||||
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian folder!
|
||||||
|
mixedEntry.decisionBranch = 138;
|
||||||
|
mixedEntry.decision = "folder_existed_both_then_do_nothing";
|
||||||
|
mixedEntry.change = false;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
|
} else {
|
||||||
mixedEntry.decisionBranch = 124;
|
mixedEntry.decisionBranch = 124;
|
||||||
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
||||||
mixedEntry.change = true;
|
mixedEntry.change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// then the folder is created on local
|
// then the folder is created on local
|
||||||
|
|
||||||
@ -1078,14 +1100,36 @@ const getSyncPlanInplace = async (
|
|||||||
mixedEntry.decision = "conflict_created_then_do_nothing";
|
mixedEntry.decision = "conflict_created_then_do_nothing";
|
||||||
mixedEntry.change = false;
|
mixedEntry.change = false;
|
||||||
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
||||||
|
if (
|
||||||
|
key === `${configDir}/` ||
|
||||||
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian/bookmarks.json file!
|
||||||
|
mixedEntry.decisionBranch = 139;
|
||||||
|
mixedEntry.decision = "conflict_created_then_keep_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
|
} else {
|
||||||
mixedEntry.decisionBranch = 39;
|
mixedEntry.decisionBranch = 39;
|
||||||
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
||||||
mixedEntry.change = true;
|
mixedEntry.change = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (
|
||||||
|
key === `${configDir}/` ||
|
||||||
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian/bookmarks.json file!
|
||||||
|
mixedEntry.decisionBranch = 140;
|
||||||
|
mixedEntry.decision = "conflict_created_then_keep_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
} else {
|
} else {
|
||||||
mixedEntry.decisionBranch = 7;
|
mixedEntry.decisionBranch = 7;
|
||||||
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
||||||
mixedEntry.change = true;
|
mixedEntry.change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// if A is in the previous list and MODIFIED, A has been deleted by B but modified by A
|
// if A is in the previous list and MODIFIED, A has been deleted by B but modified by A
|
||||||
if (skipSizeLargerThan <= 0 || local.sizeEnc! <= skipSizeLargerThan) {
|
if (skipSizeLargerThan <= 0 || local.sizeEnc! <= skipSizeLargerThan) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user