diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-10-14 22:53:14 -0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-11-03 14:33:24 -0300 |
commit | fe4874c43d3387aed52d95bc2892b27e551ac7a9 (patch) | |
tree | da885f5b66bb7f09cceea4a6f41e34990343bd3f /app/models/concerns | |
parent | dea6d054cdf3082651e356875e4a9225933a2383 (diff) | |
download | gitlab-ce-fe4874c43d3387aed52d95bc2892b27e551ac7a9.tar.gz |
Use Gitlab::Git operations for repository mirroringce-gitlab-git-backport
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/repository_mirroring.rb | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/app/models/concerns/repository_mirroring.rb b/app/models/concerns/repository_mirroring.rb deleted file mode 100644 index f6aba91bc4c..00000000000 --- a/app/models/concerns/repository_mirroring.rb +++ /dev/null @@ -1,32 +0,0 @@ -module RepositoryMirroring - IMPORT_HEAD_REFS = '+refs/heads/*:refs/heads/*'.freeze - IMPORT_TAG_REFS = '+refs/tags/*:refs/tags/*'.freeze - - def set_remote_as_mirror(name) - # This is used to define repository as equivalent as "git clone --mirror" - raw_repository.rugged.config["remote.#{name}.fetch"] = 'refs/*:refs/*' - raw_repository.rugged.config["remote.#{name}.mirror"] = true - raw_repository.rugged.config["remote.#{name}.prune"] = true - end - - def set_import_remote_as_mirror(remote_name) - # Add first fetch with Rugged so it does not create its own. - raw_repository.rugged.config["remote.#{remote_name}.fetch"] = IMPORT_HEAD_REFS - - add_remote_fetch_config(remote_name, IMPORT_TAG_REFS) - - raw_repository.rugged.config["remote.#{remote_name}.mirror"] = true - raw_repository.rugged.config["remote.#{remote_name}.prune"] = true - end - - def add_remote_fetch_config(remote_name, refspec) - run_git(%W[config --add remote.#{remote_name}.fetch #{refspec}]) - end - - def fetch_mirror(remote, url) - add_remote(remote, url) - set_remote_as_mirror(remote) - fetch_remote(remote, forced: true) - remove_remote(remote) - end -end |