Fork repository
Stages:
-
~"Client Implementation": #825 (closed) -
~"Acceptance Testing": #881 (closed)
RPC Endpoints:
Endpoint::Name
Known Client Routes:
- Known client endpoints
This should follow the algorithm of gitlab-projects fork-repository. Implement in Go not gitaly-ruby because forking can be slow and gitaly-ruby can be memory-restarted.
The request should contain a repository field (the repo to be created) and a source_repository. Use the gitaly-servers http/2 header to send the address+token of the gitaly server the source is on. Also when the source is on the same gitaly server as the target.
- check that the directory does not already exist
- mkdir-p the new repo directory
- use GIT_SSH_COMMAND and
git clone ssh://gitaly/internal.git
to do a clone viagitaly-ssh
. The directory where gitaly-ssh is installed is already in our config - remove the
origin
remote - call the RepositoryService::CreateRepository RPC on the new repository. this will set up the hooks symlink
Failing test cases:
- directory foo/bar.git exists at new repo path: fail
- file foo/bar.git exists at new repo path: fail
-
gitaly-servers
http/2 header not set: fail - source repository not found: fail
Checks on success:
- git fsck in the new repo
- hooks directory is a symlink in the new repo
- git remote
origin
is NOT set
Edited by Zeger-Jan van de Weg