2 Commits

Author SHA1 Message Date
Blair Hamilton
20f95aa25e
feat: Add --sync-default-branch CLI flag and refactor logging
- 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
2025-12-15 14:36:14 -05:00
Blair Hamilton
70f9fb45b8
Add sync feature with comprehensive testing and documentation
- 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
2025-12-08 11:14:28 -05:00