Skip to content

Repo synchronization logic update#2

Merged
genedna merged 28 commits intogitmono-dev:mainfrom
wujian0327:main
Jan 4, 2026
Merged

Repo synchronization logic update#2
genedna merged 28 commits intogitmono-dev:mainfrom
wujian0327:main

Conversation

@wujian0327
Copy link
Contributor

  • Supports repo clone and repo pull
  • The repository will be synchronized between nodes.

wujian0327 and others added 21 commits November 14, 2025 18:47
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>
Copilot AI review requested due to automatic review settings January 2, 2026 09:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 refs table instead of a JSON field in the repos table
  • Background sync task added to periodically check local repositories for ref updates
  • New CLI commands: repo pull to update existing cloned repositories and enhanced repo clone with 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.

@wujian0327
Copy link
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

wujian0327 and others added 5 commits January 2, 2026 19:11
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>
wujian0327 and others added 2 commits January 2, 2026 19:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@genedna genedna merged commit f6088cd into gitmono-dev:main Jan 4, 2026
@claude claude bot mentioned this pull request Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants