Repo synchronization logic update#2
Merged
genedna merged 28 commits intogitmono-dev:mainfrom Jan 4, 2026
Merged
Conversation
Contributor
wujian0327
commented
Jan 2, 2026
- Supports repo clone and repo pull
- The repository will be synchronized between nodes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the repository storage architecture to support repository synchronization between nodes by separating Git refs into a dedicated database table, and adds repository clone and pull functionality.
Key Changes
- Database schema refactored to store Git refs in a separate
refstable instead of a JSON field in therepostable - Background sync task added to periodically check local repositories for ref updates
- New CLI commands:
repo pullto update existing cloned repositories and enhancedrepo clonewith automatic ref tracking - Gossip protocol enhanced to detect and handle repository updates by comparing refs
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| src/storage/ref_model.rs | New module implementing the refs table entity with CRUD operations for tracking branch/tag commits |
| src/storage/repo_model.rs | Removed refs field from repos table; now delegates ref storage to ref_model |
| src/storage/mod.rs | Added refs table schema creation and exposed ref_model module |
| src/repo/repo_sync.rs | New background task that periodically checks local repositories for ref changes and updates the database |
| src/repo/mod.rs | Exposed repo_sync module and start_repo_sync_task function |
| src/gossip/service.rs | Enhanced to detect repository updates by comparing refs and trigger bundle re-sync when changes detected |
| src/git/pack.rs | Added extract_bundle_refs and pull_repo_from_bundle functions for bundle operations |
| src/git/git_repo.rs | Added read_repo_refs function to extract all refs from a git repository |
| src/cli/repo.rs | New CLI handler module for repository commands (add, list, pull, clone) |
| src/cli/node.rs | New CLI handler module for node commands (start, id) |
| src/cli/auth.rs | New CLI handler module for auth initialization |
| src/cli/mod.rs | New module organizing CLI command handlers |
| src/main.rs | Refactored to use new CLI handler modules; simplified main logic |
| README.md | Updated with comprehensive two-node network example demonstrating repository synchronization |
Comments suppressed due to low confidence (1)
src/storage/mod.rs:122
- Missing database migration strategy. The refs field has been removed from the repos table schema, but there's no migration logic to handle existing databases. Existing installations will have the old schema with the refs column, which could cause issues. Consider adding migration logic to drop the old column and migrate data to the new refs table, or document the breaking change for users.
name TEXT NOT NULL,
creator TEXT NOT NULL,
description TEXT NOT NULL,
timestamp INTEGER NOT NULL,
path TEXT NOT NULL,
bundle TEXT NOT NULL DEFAULT '',
is_external INTEGER NOT NULL DEFAULT 0,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
)",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
genedna
approved these changes
Jan 4, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.