8000 Add: --mirror suport for push and clone · Issue #40 · awesome-os/universal-git · GitHub
[go: up one dir, main page]

Skip to content

Add: --mirror suport for push and clone #40

Open

Description

@lemanschik

push --mirror

Client (Mirror)                            Server
--------------------------------------------------------
Step 1: Connect to server
  |                                           |
  | --- git-receive-pack /repo.git ---------->|
  |                                           |
Step 2: Capability handshake
  |                                           |
  | <-- server advertises capabilities ------|
  |     capabilities: report-status delete-refs side-band-64k
  |                                           |
Step 3: Client sends refs update request (mirror mode)
  |                                           |
  | --- push all refs:                          |
  |     refs/heads/main -> refs/heads/main    |
  |     refs/heads/feature-x -> refs/heads/feature-x
  |     refs/tags/v1.0 -> refs/tags/v1.0     |
  |                                           |
Step 4: Server validates and applies updates
  |                                           |
  | <-- server sends status for each ref ----|
  |     ok refs/heads/main
  |     ok refs/heads/feature-x
  |     ok refs/tags/v1.0
  |                                           |
Step 5: Update complete
  |                                           |
  | Mirror repo on server now exactly matches client
  | refs/* = all client refs

clone --mirror

Client (Normal Clone)                     Server
------------------------------------------------------
Step 1: Connect to server
  | --- git-upload-pack /repo.git ------->|
  |                                       |
Step 2: Capability handshake (v1/v2)
  | <--- refs + capabilities ------------|
  |       refs/heads/main
  |       refs/heads/feature-x
  |       refs/tags/v1.0
  |       capabilities: multi_ack thin-pack ofs-delta
Step 3: Client requests pack for default + needed refs
  | --- request pack ------------------->|
Step 4: Server sends pack
  | <--- pack with requested objects ----|
Step 5: Update local repo
  | refs/remotes/origin/main      <-- tracked remote branch
  | refs/remotes/origin/feature-x
  | refs/tags/v1.0                 <-- local tags




Client (Mirror Clone)                     Server
------------------------------------------------------
Step 1: Connect to server
  | --- git-upload-pack /repo.git ------->|
Step 2: Capability handshake (v1/v2)
  | <--- refs + capabilities ------------|
  |       refs/heads/main
  |       refs/heads/feature-x
  |       refs/tags/v1.0
  |       capabilities: multi_ack thin-pack ofs-delta
Step 3: Client requests pack (mirror mode)
  | --- request all refs using capabilities -->|
Step 4: Server sends pack with ALL objects
  | <--- pack containing all refs ------------|
Step 5: Update mirror repo
  | refs/heads/main         <-- exactly mirrors origin
  | refs/heads/feature-x    <-- exactly mirrors origin
  | refs/tags/v1.0          <-- exactly mirrors origin
  | refs/*                  <-- everything mirrored

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0