diff options
| author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-04-03 14:46:00 -0300 |
|---|---|---|
| committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-04-03 15:50:22 -0300 |
| commit | 35fe9c660cc5309e244ce1bde5f65b4e7ec73e4e (patch) | |
| tree | 8e01ff0cb1d458b6d9f150231a4191b7acfde3a8 /app/models/concerns | |
| parent | 6e64071e2065dc20d9a7afdce39a68b6172eea1f (diff) | |
| download | gitlab-ce-35fe9c660cc5309e244ce1bde5f65b4e7ec73e4e.tar.gz | |
Move methods that are not related to mirroring to the repository model
Diffstat (limited to 'app/models/concerns')
| -rw-r--r-- | app/models/concerns/repository_mirroring.rb | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/app/models/concerns/repository_mirroring.rb b/app/models/concerns/repository_mirroring.rb index 7aca3f72ae7..fed336c29d6 100644 --- a/app/models/concerns/repository_mirroring.rb +++ b/app/models/concerns/repository_mirroring.rb @@ -1,21 +1,4 @@ module RepositoryMirroring - def storage_path - @project.repository_storage_path - end - - def add_remote(name, url) - raw_repository.remote_add(name, url) - rescue Rugged::ConfigError - raw_repository.remote_update(name, url: url) - end - - def remove_remote(name) - raw_repository.remote_delete(name) - true - rescue Rugged::ConfigError - false - end - def set_remote_as_mirror(name) config = raw_repository.rugged.config @@ -25,7 +8,10 @@ module RepositoryMirroring config["remote.#{name}.prune"] = true end - def fetch_remote(remote, forced: false, no_tags: false) - gitlab_shell.fetch_remote(storage_path, path_with_namespace, remote, forced: forced, no_tags: no_tags) + def fetch_mirror(remote, url) + add_remote(remote, url) + set_remote_as_mirror(remote) + fetch_remote(remote, forced: true) + remove_remote(remote) end end |
