275 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
gabrie30
4d87d97b59
Bump version to v1.11.8 and update changelog
Prepared for the next release by updating the version constant to v1.11.8 in cmd/version.go and adding a new unreleased section to CHANGELOG.md.
2025-12-06 08:01:17 -08:00
gabrie30
eceb10f6d4
Add GHORG_FETCH_ALL check to no-clean mode processing (#594)
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.
2025-11-08 07:36:03 -08:00
gabrie30
f05578e580
Bump version to v1.11.7 and update changelog
Updated the version constant in cmd/version.go to v1.11.7 and added an unreleased section for 1.11.7 in CHANGELOG.md to prepare for the next release.
2025-11-06 07:53:42 -08:00
gabrie30
43647d3fd3
Strip tilde from Sourcehut usernames in output dir 2025-11-06 07:51:17 -08:00
gabrie30
5c1d87b69d
updates 2025-11-03 21:58:34 -08:00
gabrie30
8ff9410049
Add Sourcehut SCM support and integration tests (#593) 2025-11-02 12:22:29 -08:00
Blake Williams
a838fb0afe
Sourcehut support (#589) 2025-11-02 08:10:41 -08:00
gabrie30
939b74f081
Bump version to v1.11.6 and update changelog 2025-10-30 22:15:10 -07:00
gabrie30
d7f973c87b
Update github_cloud_integration_tests.sh (#588) 2025-10-30 07:47:18 -07:00
François Gouteroux
849491d3bf
feat: add ghorgonly file to clone only targets repo matching lines substring (#587) 2025-10-30 00:04:01 -07:00
gabrie30
12bc4eb487
Refactor to use 'any' instead of 'interface{}' (#574) 2025-09-08 07:46:19 -07:00
gabrie30
b702d503e7
Add Bitbucket Server support and integration tests (#569) 2025-08-31 22:33:45 -07:00
gabrie30
ccd0fc8651
Update version.go 2025-08-30 08:34:24 -07:00
gabrie30
fd26d5e698
Add clone delay option with auto concurrency adjustment (#567)
* 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.
2025-08-28 17:35:40 -07:00
gabrie30
805422943a
Track and record clone operation duration in stats (#560) 2025-08-24 18:36:18 -07:00
gabrie30
f561d77357
Ensure credentials are stripped from git remotes after fetch (#559) 2025-08-24 15:56:25 -07:00
gabrie30
c4a30ac9bf
Improve GitLab snippet and wiki clone consistency (#557) 2025-08-24 14:10:33 -07:00
gabrie30
be75c52bc9
Refactor repo filtering and processing logic and GitLab Integration tests (#551) 2025-08-24 11:34:33 -07:00
gabrie30
f69a19b94e
Fix/pathing (#548)
* 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.
2025-08-19 18:06:56 -07:00
gabrie30
bf87e26c49
Bump version to v1.11.4 and update changelog
Updated the version constant in cmd/version.go to v1.11.4 and added a new unreleased section for 1.11.4 in CHANGELOG.md.
2025-07-04 04:29:22 -07:00
gabrie30
2b0f850538
Update to v1.11.3 and add tini to Dockerfile (#543) 2025-07-03 09:02:21 -07:00
gabrie30
ff25dc27c0
Update reclone-cron.go (#542) 2025-07-02 07:44:17 -07:00
Richard Steinbrück
8e197fe8ec
feat: add post_exec_script support (#520) 2025-06-29 11:18:06 -07:00
gabrie30
692b85e3db
Update integration-tests.sh (#532) 2025-05-17 16:59:08 -07:00
João Fraga
0a2bafb95c
feat: allow usage of --prune with --preserve-dir (#526) 2025-05-17 08:37:35 -07:00
gabrie30
41c67cf765
Revert "feat: allow usage of --prune with --preserve-dir" (#525) 2025-05-11 11:02:53 -07:00
gabrie30
f077821c74
Update bitbucket_cloud_integration_tests.sh (#524) 2025-05-11 10:59:10 -07:00
João Fraga
6f0826452b
feat: allow usage of --prune with --preserve-dir (#521) 2025-05-10 11:27:42 -07:00
gabrie30
6ef949b422
Update unreleased version 2025-05-01 06:13:21 -07:00
Elmar Fasel
a1395a2a6f
Empty repos should not fail on pull (#513) 2025-04-29 18:34:07 -07:00
gabrie30
e753eeb81f
Update version.go 2024-10-16 19:31:24 -07:00
Jay Gabriels
960279b72d
Update changelog and spelling 2024-09-28 07:55:04 -07:00
gabrie30
d1bb7c3044
Add/reclone cmds (#461) 2024-09-27 17:23:35 -07:00
Paarth Shah
f19d6b7dcf
Allow github app token created outside of ghorg to be used for https via GHORG_GITHUB_TOKEN_FROM_GITHUB_APP setting (#460) 2024-09-25 20:57:28 +05:30
gabrie30
f76d38ba4c
Update prune untouched documentation 2024-09-23 08:38:55 -07:00
gabrie30
3b110bf86a
Update clone.go 2024-09-22 18:39:10 -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
ca104ddd8b
Make reclone output more detailed (#457) 2024-09-20 19:52:06 -07:00
gabrie30
9e64a97d63
Update unreleased version 2024-09-20 18:17:43 -07:00
gabrie30
7838aa7af7
Merge branch 'master' of https://github.com/gabrie30/ghorg 2024-09-20 18:11:44 -07:00
gabrie30
35dda34fdf
Update version.go 2024-09-20 18:11:34 -07:00
gabrie30
7222d63e73
Update reclone with better stdout and stderr (#456) 2024-09-20 18:10:48 -07:00
gabrie30
f3383ddca4
Add/GitHub language filter (#453) 2024-09-18 20:47:58 -07:00
gabrie30
c6061eaaf9
Update ls.go (#452) 2024-09-17 23:17:04 -07:00
gabrie30
e6143784f3
Add spinner to ghorg ls command (#451) 2024-09-17 22:45:01 -07:00
gabrie30
08add68314
Update/ghorgls (#450) 2024-09-16 18:22:06 -07:00
gabrie30
0bfd95159c
Add/ghorg stats (#449) 2024-09-15 12:28:40 -07:00