fix smart conflict for .obsidian
This commit is contained in:
parent
56bd4c000e
commit
11c66d7030
@ -296,7 +296,8 @@ const getSyncPlanInplace = async (
|
|||||||
syncDirection: SyncDirectionType,
|
syncDirection: SyncDirectionType,
|
||||||
profiler: Profiler | undefined,
|
profiler: Profiler | undefined,
|
||||||
settings: RemotelySavePluginSettings,
|
settings: RemotelySavePluginSettings,
|
||||||
triggerSource: SyncTriggerSourceType
|
triggerSource: SyncTriggerSourceType,
|
||||||
|
configDir: string
|
||||||
) => {
|
) => {
|
||||||
profiler?.addIndent();
|
profiler?.addIndent();
|
||||||
profiler?.insert("getSyncPlanInplace: enter");
|
profiler?.insert("getSyncPlanInplace: enter");
|
||||||
@ -582,7 +583,11 @@ const getSyncPlanInplace = async (
|
|||||||
if (prevSync === undefined) {
|
if (prevSync === undefined) {
|
||||||
// Didn't exist means both are new
|
// Didn't exist means both are new
|
||||||
if (syncDirection === "bidirectional") {
|
if (syncDirection === "bidirectional") {
|
||||||
if (conflictAction === "keep_newer") {
|
if (
|
||||||
|
conflictAction === "keep_newer" ||
|
||||||
|
(conflictAction === "smart_conflict" &&
|
||||||
|
key.startsWith(`${configDir}/`))
|
||||||
|
) {
|
||||||
if (
|
if (
|
||||||
(local.mtimeCli ?? local.mtimeSvr ?? 0) >=
|
(local.mtimeCli ?? local.mtimeSvr ?? 0) >=
|
||||||
(remote.mtimeCli ?? remote.mtimeSvr ?? 0)
|
(remote.mtimeCli ?? remote.mtimeSvr ?? 0)
|
||||||
@ -640,7 +645,11 @@ const getSyncPlanInplace = async (
|
|||||||
} else {
|
} else {
|
||||||
// Both exist but don't compare means both are modified
|
// Both exist but don't compare means both are modified
|
||||||
if (syncDirection === "bidirectional") {
|
if (syncDirection === "bidirectional") {
|
||||||
if (conflictAction === "keep_newer") {
|
if (
|
||||||
|
conflictAction === "keep_newer" ||
|
||||||
|
(conflictAction === "smart_conflict" &&
|
||||||
|
key.startsWith(`${configDir}/`))
|
||||||
|
) {
|
||||||
if (
|
if (
|
||||||
(local.mtimeCli ?? local.mtimeSvr ?? 0) >=
|
(local.mtimeCli ?? local.mtimeSvr ?? 0) >=
|
||||||
(remote.mtimeCli ?? remote.mtimeSvr ?? 0)
|
(remote.mtimeCli ?? remote.mtimeSvr ?? 0)
|
||||||
@ -1712,7 +1721,8 @@ export async function syncer(
|
|||||||
settings.syncDirection ?? "bidirectional",
|
settings.syncDirection ?? "bidirectional",
|
||||||
profiler,
|
profiler,
|
||||||
settings,
|
settings,
|
||||||
triggerSource
|
triggerSource,
|
||||||
|
configDir
|
||||||
);
|
);
|
||||||
console.debug(`mixedEntityMappings:`);
|
console.debug(`mixedEntityMappings:`);
|
||||||
console.debug(mixedEntityMappings); // for debugging
|
console.debug(mixedEntityMappings); // for debugging
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user