aboutsummaryrefslogtreecommitdiffstats
path: root/watcher_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Add Windows native watcher with Unix socket IPCBernhard Guillon2026-07-071-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Architecture: - Windows binary: watches files via ReadDirectoryChangesW (fsnotify), sends events as newline-delimited JSON over Unix domain socket - Container: performs initial sync, then listens on socket for events from Windows watcher New files: - cmd_windows.go: Windows serve command (watcher + socket server) - cmd_linux.go: Linux socket client + event listener - types.go: shared FileEvent, FileMeta, Manifest types - watcher_test_helper.go: inotify-based watcher for integration tests Changes: - main.go: simplified to just call run() - watcher.go: removed fsnotify dependency, extracted Watcher interface - sync.go: removed duplicate type definitions - watcher_test.go: uses watchForTests() helper Usage: sourcewatch.exe -dir C:\myproject -socket D:\sourcewatch.sock docker run -v D:\sourcewatch.sock:/run/sourcewatch.sock \ -v C:\myproject:/host:ro -v mydata:/data sourcewatch
* Add log level system and sync loggingBernhard Guillon2026-07-061-16/+16
| | | | | | | | | - log.go: log level system (DEBUG, INFO, WARN, ERROR, NONE) - CLI: -log-level flag (default info), -verbose as shorthand for debug - Watcher: logs sync/remove actions at INFO level - Watcher: logs events at DEBUG level - Errors: structured error messages (DISK FULL, PERMISSION DENIED, etc.) - Updated README with -log-level flag
* Add symlink watcher support with testsBernhard Guillon2026-07-061-0/+149
| | | | | | | | | | | - syncCreate: remove existing file before creating symlink - syncWrite: handle symlink target changes (remove + recreate) - Added 4 new tests: - CreateSymlink: new symlink synced to /data - UpdateSymlinkTarget: symlink target change updates /data - RemoveSymlink: symlink removal synced - ModifySymlinkTargetFile: target file change preserves symlink - 39 tests passing
* Implement nested .gitignore support with GitignoreStackBernhard Guillon2026-07-061-45/+81
| | | | | | | | | | | | | | | - Replaced go-gitignore with custom GitignoreStack that tracks multiple .gitignore files hierarchically - Patterns are processed in root-to-leaf order, last match wins - Negation patterns in child dirs override parent ignores - Patterns only apply within their directory scope (no leaking) - Added 6 new tests for nested .gitignore: - Scoped: patterns only affect own directory - Dir-scoped: different dirs can ignore different things - Negation override: child !pattern un-ignores parent's *.pattern - Deep nesting: 3+ levels of .gitignore - Parent scope doesn't leak to siblings - All 35 tests passing
* Add watcher tests, refactor watch() to accept contextBernhard Guillon2026-07-061-0/+325
- Added watcher_test.go: 10 tests covering create, write, remove, rename, ignored files, debouncing, directory creation/removal, and manifest updates - Refactored watch() to accept context.Context for clean cancellation - Added signal handling (SIGINT/SIGTERM) for graceful shutdown in main.go - Fixed test expectations (version two = 11 bytes, not 10)