- Add --sync-default-branch flag to clone command for enabling sync feature via CLI
- Add syncDefaultBranch variable and flag handler in cmd package
- Refactor git/sync.go to use colorlog consistently throughout
- Convert all fmt.Printf debug statements to colorlog.PrintInfo/PrintSuccess/PrintError
- Remove all GHORG_DEBUG environment variable checks
- Return formatted errors with context using fmt.Errorf for better error messages
- Add comprehensive tests for sync-default-branch flag
- Test default value is false
- Test flag sets environment variable correctly
- All existing tests continue to pass
- Implement SyncDefaultBranch function with 4 safety checks
- Add 8 git helper functions (GetRemoteURL, HasLocalChanges, etc.)
- Add 640 lines of unit tests for git helpers (git_test.go)
- Add 2074 lines of sync tests with 45+ scenarios (sync_test.go)
- Integrate GHORG_SYNC_DEFAULT_BRANCH environment variable
- Add 8 testing targets to Makefile
- Update README.md with comprehensive sync feature documentation
- Update sample-conf.yaml with detailed configuration comments
- Add test coverage verification document
Safety checks implemented:
- Skips sync if uncommitted local changes
- Skips sync if unpushed commits
- Skips sync if commits not on default branch
- Skips sync if default branch diverged from HEAD
Test coverage: 51.6% overall, 76-100% on new functions
The handleNoCleanMode function now only performs fetch-all operations if GHORG_FETCH_ALL is set to true, improving control over repository processing. Added tests to verify behavior when fetch-all is enabled and disabled.
* Add clone delay option with auto concurrency adjustment
Introduces GHORG_CLONE_DELAY_SECONDS to control delay between cloning repositories for rate limiting. When set to a value greater than 0, concurrency is automatically set to 1 for predictable behavior. Updates CLI flags, environment variable defaults, config printing, and sample config documentation. Applies delay before cloning or pulling repositories.
* Refactor clone delay logic and add helper functions
Introduced helper functions for parsing and applying clone delay configuration, improving code reuse and readability. Centralized delay logic in repository processing and removed duplicate environment variable checks. Now, clone delay is consistently applied and concurrency is auto-adjusted when necessary.
* Normalize path separators in repo matching logic
Updated sliceContainsNamedRepo to normalize both forward and back slashes for cross-platform compatibility. Added tests to verify correct matching behavior with various path separator combinations, addressing issues with Windows and GitLab API inconsistencies.