diff options
author | Stan Hu <stanhu@gmail.com> | 2018-08-22 20:43:15 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-08-23 03:02:09 +0300 |
commit | 578137f6e4817591e98019bf3e88065fae0a2879 (patch) | |
tree | db9c2abd185dad5782d6efd7747ac4d6edbc1926 /app/services/projects | |
parent | f1315c85f91c76d308069a741db2a4a0d89d509e (diff) |
Fix remote mirrors failing if Git remotes have not been added
Remote mirrors only get created when the URL changes, However, during the GCP
migration, the remote mirror did not get created automatically. Plus, there's
no guarantee someone restoring a repository from backup would have this
remote. We now add the remote each time we attempt to fetch from the
repository.
This works because Gitaly doesn't throw up an exception or error if the
remote already exists:
https://gitlab.com/gitlab-org/gitaly/issues/1317
In the future, we should attempt to add if the remote doesn't exist:
https://gitlab.com/gitlab-org/gitaly/issues/1316
Closes #50562
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/update_remote_mirror_service.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/services/projects/update_remote_mirror_service.rb b/app/services/projects/update_remote_mirror_service.rb index 4651f7c4f8f..591b38b8151 100644 --- a/app/services/projects/update_remote_mirror_service.rb +++ b/app/services/projects/update_remote_mirror_service.rb @@ -10,6 +10,7 @@ module Projects return success unless remote_mirror.enabled? begin + remote_mirror.ensure_remote! repository.fetch_remote(remote_mirror.remote_name, no_tags: true) opts = {} |