aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add robust error handling for TCP communicationBernhard Guillon2026-07-072-17/+47
| | | | | | | | | | | Windows side: - sendManifest/sendEvent now return errors - Callers log errors and reconnect on failure Linux side: - 30s read timeout to detect dead connections - Better batch counting and logging - Proper error logging on disconnect
* Chunk manifest transfer: 1000 files per batchBernhard Guillon2026-07-072-12/+51
| | | | | Avoids bufio.Scanner token limit by sending manifest in batches. Each batch is a separate JSON line with up to 1000 files.
* Increase scanner buffer to 64MB for 479k+ file manifestsBernhard Guillon2026-07-071-1/+1
|
* Increase scanner buffer to 1MB for large manifestsBernhard Guillon2026-07-071-0/+1
|
* Switch from Unix sockets to TCP for Docker Desktop compatibilityBernhard Guillon2026-07-073-116/+101
| | | | | | | | | | | | | | Architecture: - Container acts as TCP server (listens on :5151) - Windows binary connects as TCP client - Same protocol: newline-delimited JSON Usage: docker run -p 5151:5151 -v C:\src:/host:ro -v data:/data sourcewatch sourcewatch.exe -dir C:\src -connect localhost:5151 This avoids Docker Desktop's inability to mount Windows Unix sockets into Linux containers (they become directories instead of files).
* Set default socket path to /run/sourcewatch.sockBernhard Guillon2026-07-071-1/+1
|
* Fix undefined logLevel: move shared flags to flags.goBernhard Guillon2026-07-072-2/+8
|
* Downgrade dependencies for Go 1.21 compatibilityBernhard Guillon2026-07-072-7/+7
| | | | | | - fsnotify v1.7.0 (was v1.10.1, required Go 1.23) - x/sys v0.4.0 (was v0.13.0, required Go 1.23) - go.mod: go 1.21 (no toolchain directive)
* Downgrade Go version to 1.21 for broader compatibilityBernhard Guillon2026-07-073-2/+3
|
* Update README with Windows binary build instructions and new architectureBernhard Guillon2026-07-071-30/+95
|
* Add Windows-assisted initial sync for faster startupBernhard Guillon2026-07-073-83/+391
| | | | | | | | | | | | | | | | | | | | | New protocol: - Windows binary scans directory (fast native NTFS) and sends manifest - Container receives manifest, compares with local /data state - Only copies files that differ (size, modtime, mode, symlink) Protocol messages: - manifest: sends full file metadata from Windows - manifest_done: signals manifest transfer complete - event_create/write/remove: file change events Flow: 1. Container connects to socket 2. Windows binary sends manifest (file metadata) 3. Container scans /data (fast local volume) 4. Container copies only changed files from /host (9P bind mount) 5. Container enters event-waiting loop This dramatically speeds up initial sync by avoiding slow 9P scans.
* Add Windows native watcher with Unix socket IPCBernhard Guillon2026-07-078-211/+575
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Watch nested dirs: recursively add watchers for subdirs on createBernhard Guillon2026-07-061-0/+7
| | | | | | When mkdir -p creates multiple nested dirs at once, only the first level got a watcher. Now syncCreate walks all subdirectories and adds watchers for them. The event handler already filters ignored paths.
* Fix event debouncing: merge ops instead of overwritingBernhard Guillon2026-07-061-6/+13
| | | | | | | | - touch fires CREATE then CHMOD, the CHMOD was overwriting CREATE in the debounce map, and CHMOD is not handled, so file was never synced - Now debounce merges event ops (CREATE|CHMOD → treated as CREATE) - Added sync/remove debug logging - Tested in Docker: create, modify, delete all working
* Add log level system and sync loggingBernhard Guillon2026-07-068-71/+161
| | | | | | | | | - 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 build instructions to READMEBernhard Guillon2026-07-061-0/+10
|
* Add Podman to READMEBernhard Guillon2026-07-061-1/+4
|
* Add progress logging for initial syncBernhard Guillon2026-07-062-1/+44
| | | | | | | | - Log start of sync with source directory - Print progress every 1000 files during sync - Log completion with stats (files, dirs, skipped, errors) and elapsed time - Print 'watcher: ready' when monitoring begins - Exit cleanly on dry-run
* Add structured error handling with retry logicBernhard Guillon2026-07-064-24/+271
| | | | | | | | | | - errors.go: retry wrapper for transient errors (ENOENT), structured error logging (disk full, permission denied, symlink loops) - sync.go: continue on individual file errors, log clearly, skip broken symlinks instead of failing entire sync - watcher.go: log all errors with context, handle readlink failures - Added 11 tests for error handling scenarios - 50 tests passing
* Add symlink watcher support with testsBernhard Guillon2026-07-062-0/+165
| | | | | | | | | | | - 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
* Add README with usage, flags, and .gitignore support docsBernhard Guillon2026-07-061-0/+70
|
* Docker test fixes: directory pattern matching, mtime-based sync, Go versionBernhard Guillon2026-07-065-7/+12
| | | | | | | | | | | | | | | | - Fixed directory pattern matching: go-gitignore doesn't match 'build/' against bare 'build', now checks with trailing slash appended - Added ModTime to FileMeta for reliable change detection (same-size file modifications now sync correctly) - Updated Dockerfile to golang:1.24-alpine (was 1.22) - Downgraded go.mod to Go 1.24 (system has custom 1.26.4 build) Docker tested with podman: - Initial sync correctly excludes ignored dirs/files - Nested .gitignore works (sub/ ignores *.tmp) - Watcher syncs new/modified/deleted files - Case-sensitive rename (Foo→foo) handled correctly - Same-size file modifications sync correctly
* Implement nested .gitignore support with GitignoreStackBernhard Guillon2026-07-066-140/+374
| | | | | | | | | | | | | | | - 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-063-2/+338
| | | | | | | | | - 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)
* Add sync and gitignore tests, fix loadGitignore bugBernhard Guillon2026-07-063-7/+614
| | | | | | | | | | | | - Added gitignore_test.go: comprehensive tests for go-gitignore patterns - Verified: *, **, [], negation, anchored patterns, comments - Documented limitation: ? wildcard not supported by go-gitignore - Added sync_test.go: integration tests for initial sync - Tests: basic files, gitignore excludes, negation, double-star, directory patterns, symlinks, permissions, dry-run, .git skip, nested gitignore, complex combined patterns - Fixed gitignore.go: use CompileIgnoreFile instead of passing entire file content as single string to CompileIgnoreLines
* Initial project scaffoldingBernhard Guillon2026-07-068-0/+414
- main.go: CLI entry point with flag parsing - gitignore.go: .gitignore loading and parsing - sync.go: initial sync with manifest tracking - watcher.go: fsnotify-based file watcher with debouncing - Dockerfile: multi-stage build for Alpine runtime