Compare commits
10 Commits
d87d05a006
...
f125f1618d
| Author | SHA1 | Date | |
|---|---|---|---|
| f125f1618d | |||
| 8c744bda82 | |||
| 4ff83d63e7 | |||
| 5647c1ea66 | |||
| 6706ad75f8 | |||
| db115e6fb3 | |||
| 3a2cdeccde | |||
| cbd8cc228e | |||
| 8f6d8f2e51 | |||
| c8b3c10f8f |
29
main.js
29
main.js
@@ -56,7 +56,7 @@ console.log("Startup-Folders:", store.get('folders'));
|
||||
|
||||
let tray = null;
|
||||
|
||||
|
||||
const MAX_FILES_PER_COMMIT = 20;
|
||||
|
||||
function createTray(win) {
|
||||
const iconPath = path.join(__dirname, 'assets/icon/trayicon.png');
|
||||
@@ -678,9 +678,32 @@ function ensureInGitignore(folderPath, name) {
|
||||
|
||||
function startMonitoringWatcher(folderPath, win) {
|
||||
if (monitoringWatchers.has(folderPath)) return;
|
||||
|
||||
// 1. Load .gitignore (and add default rules for .git, node_modules, etc.)
|
||||
const ig = ignore();
|
||||
const gitignorePath = path.join(folderPath, '.gitignore');
|
||||
if (fs.existsSync(gitignorePath)) {
|
||||
ig.add(fs.readFileSync(gitignorePath, 'utf-8'));
|
||||
}
|
||||
// Always ignore .git and node_modules just in case (safety net)
|
||||
ig.add(['.git', 'node_modules']);
|
||||
|
||||
// 2. Function for chokidar
|
||||
function ignoredFunc(absPath) {
|
||||
// Chokidar gives us absolute path; convert to relative to repo root
|
||||
const rel = path.relative(folderPath, absPath);
|
||||
// Always ignore the root .git folder
|
||||
if (rel === '.git' || rel.startsWith('.git' + path.sep)) return true;
|
||||
// Same for node_modules
|
||||
if (rel === 'node_modules' || rel.startsWith('node_modules' + path.sep)) return true;
|
||||
// .gitignore logic (note: '' means root, which is never ignored)
|
||||
return rel && ig.ignores(rel);
|
||||
}
|
||||
|
||||
// 3. Create the watcher, now with deep ignore support!
|
||||
const watcher = chokidar.watch(folderPath, {
|
||||
ignored: /(^|[\/\\])\..|\.git/,
|
||||
ignoreInitial: false, // wichtig: ruft add-Events für vorhandene Dateien auf!
|
||||
ignored: ignoredFunc,
|
||||
ignoreInitial: false,
|
||||
persistent: true,
|
||||
depth: 99,
|
||||
awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }
|
||||
|
||||
@@ -15,6 +15,7 @@ window.addEventListener('DOMContentLoaded', async () => {
|
||||
paginationEl.className = 'pagination flex justify-center items-center my-2 space-x-2';
|
||||
contentList.parentElement.insertBefore(paginationEl, contentList);
|
||||
|
||||
|
||||
let lastFolderPath = null;
|
||||
let lastPage = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user