16 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
Elmar Fasel
edb31ec90f
Execute git ls-remote in current repo’s directory (#515) 2025-04-30 15:08:48 -07:00
Elmar Fasel
a1395a2a6f
Empty repos should not fail on pull (#513) 2025-04-29 18:34:07 -07:00
Elmar Fasel
c3a68ba688
Use '--' to separate paths from revisions (#509) 2025-04-08 18:12:07 -07:00
gabrie30
230725234c
Add/ghorg prune untouched (#459) 2024-09-22 15:49:21 -07:00
gabrie30
1ca84c6c42
Add preserve scm hostname flag (#458) 2024-09-21 20:06:27 -07:00
gabrie30
7167cd4207
Add commit count to output (#440) 2024-07-18 08:37:58 -07:00
Darren Gibson
150e326a65
Prevent checkout failure on default branch change (#437) 2024-07-16 19:00:40 -07:00
gabrie30
e8303f96cc
Add more debugging output to git commands when debug mode is enabled (#412) 2024-05-15 17:17:51 -07:00
gabrie30
be94d04c89
Add clone depth flag (#315) 2023-06-03 08:12:51 -07:00
Jay Gabriels
178d084879
Fix scms prompting for credentials (#240) 2022-08-19 11:27:11 -07:00
Jay Gabriels
9f5ca3d3c4
Add git filter flag to clone command (#236) 2022-08-13 10:24:10 -07:00
Jay Gabriels
1c74595dce
Add include submodules flag (#235) 2022-08-12 18:17:02 -07:00
Jay Gabriels
33e147b317
Add no clean flag (#154) 2021-09-28 20:12:11 -07:00
Jay Gabriels
f5cbf68006
Refactor git into an interface (#146)
* Refactor git into an interface
2021-08-25 20:34:36 -07:00