From b0a23ed2accbe6f77ab3e88c2e14321e66a07fbe Mon Sep 17 00:00:00 2001 From: Dwynr Date: Fri, 13 Dec 2024 04:24:23 +0100 Subject: [PATCH] feat: discern directories for ignore --- package-lock.json | 4 ++-- package.json | 2 +- src/lib/deltas.ts | 11 ++++++++++- src/lib/filesystems/local.ts | 1 + src/lib/filesystems/remote.ts | 1 + 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index da777f4..54fbca4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@filen/sync", - "version": "0.1.93", + "version": "0.1.95", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@filen/sync", - "version": "0.1.93", + "version": "0.1.95", "license": "AGPLv3", "dependencies": { "@filen/sdk": "^0.1.191", diff --git a/package.json b/package.json index 2071e95..aefe935 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@filen/sync", - "version": "0.1.94", + "version": "0.1.95", "description": "Filen Sync", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/lib/deltas.ts b/src/lib/deltas.ts index 2294921..3897373 100644 --- a/src/lib/deltas.ts +++ b/src/lib/deltas.ts @@ -494,7 +494,16 @@ export class Deltas { .sort((a, b) => a.path.split("/").length - b.path.split("/").length) // Filter by ignored paths .filter(delta => { - const trailingSlash = delta.type.endsWith("Directory") ? "/" : "" + const trailingSlash = + delta.type === "renameLocalDirectory" || + delta.type === "createLocalDirectory" || + delta.type === "createRemoteDirectory" || + delta.type === "deleteLocalDirectory" || + delta.type === "renameRemoteDirectory" || + delta.type === "deleteRemoteDirectory" + ? "/" + : "" + if ( delta.type === "renameLocalDirectory" || delta.type === "renameLocalFile" || diff --git a/src/lib/filesystems/local.ts b/src/lib/filesystems/local.ts index 02b6dd9..f6c4b4f 100644 --- a/src/lib/filesystems/local.ts +++ b/src/lib/filesystems/local.ts @@ -188,6 +188,7 @@ export class LocalFileSystem { } const trailingSlash = type === "directory" ? "/" : "" + if (this.sync.ignorer.ignores(relativePath + trailingSlash)) { this.ignoredCache.set(relativePath, { ignored: true, diff --git a/src/lib/filesystems/remote.ts b/src/lib/filesystems/remote.ts index 77a83e2..9bcdc84 100644 --- a/src/lib/filesystems/remote.ts +++ b/src/lib/filesystems/remote.ts @@ -185,6 +185,7 @@ export class RemoteFileSystem { } const trailingSlash = type === "directory" ? "/" : "" + if (this.sync.ignorer.ignores(relativePath + trailingSlash)) { this.ignoredCache.set(key, { ignored: true,