diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-23 17:36:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-23 17:36:03 +0300 |
| commit | 8706e6a82819c0c16a0c157283de2f14af2664c3 (patch) | |
| tree | bacf3d7f61e14d0400cb541e36f5ab49de6d7a33 /internal/config/config.go | |
| parent | 60691a6fb610cb7f7290d6ab3a26bc74f95af611 (diff) | |
Add repository synchronization functionality
- Create sync package to handle git repository synchronization
- Implement multi-organization sync with branch tracking
- Add merge conflict detection and error handling
- Support cloning, fetching, merging, and pushing across all remotes
- Add --sync flag to synchronize repositories
- Add --work-dir flag for working directory specification
- Create test infrastructure with setup and conflict test scripts
- Update config validation to support file:// URLs
- Add comprehensive .gitignore entries for test artifacts
The sync package automatically:
- Clones repositories if not present
- Fetches updates from all configured organizations
- Merges changes from all remotes for each branch
- Pushes synchronized changes to all organizations
- Detects and reports merge conflicts for manual resolution
Test with: ./test/setup_test_repos.sh && ./gitsyncer --config test/test-config.json --sync test-repo
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/config/config.go')
| -rw-r--r-- | internal/config/config.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 91c107a..0fe1ac8 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "strings" ) // Organization represents a git organization with its host and name @@ -59,7 +60,8 @@ func (c *Config) Validate() error { if org.Host == "" { return fmt.Errorf("organization %d: missing host", i) } - if org.Name == "" { + // Name can be empty for file:// URLs + if org.Name == "" && !strings.HasPrefix(org.Host, "file://") { return fmt.Errorf("organization %d: missing name", i) } } |
