From 6f098b7906dc1f144cfefdc1850b1968afca0a5f Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 1 Jun 2025 06:27:17 +0200 Subject: [PATCH] Refactor watcher logic to ignore empty or relative paths --- main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.js b/main.js index 71dd036..b86f233 100644 --- a/main.js +++ b/main.js @@ -472,6 +472,7 @@ async function startMonitoringWatcher(folderPath, win) { // Relativer Pfad zum Repo const rel = path.relative(folderPath, filePath); + if (!rel || rel === '' || rel === '.') return true; // 1) Wenn die Datei in der .gitignore steht → ignorieren if (igFilter.ignores(rel)) return true; // 2) Ansonsten wird die Änderung durch unseren Code ohnehin @@ -494,6 +495,7 @@ async function startMonitoringWatcher(folderPath, win) { // sonst normal doAutoCommitWithIgnoreCheck() aufrufen. watcher.on('all', async (event, filePathAbsolute) => { const rel = path.relative(folderPath, filePathAbsolute); + if (!rel || rel === '' || rel === '.') return; // a) Prüfe, ob dieser Pfad durch die aktuell geladene .gitignore // bereits ausgeschlossen ist (z.B. node_modules/foo.js):