Commit b23432dc authored by Rubén Dávila's avatar Rubén Dávila

Don't fetch tags when fetching remote mirror.

* Add the ability to skip tags when fetching a remote repo.
  See: https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/46
parent ab83917c
...@@ -213,8 +213,8 @@ class Repository ...@@ -213,8 +213,8 @@ class Repository
remote_config["remote.#{name}.prune"] = true remote_config["remote.#{name}.prune"] = true
end end
def fetch_remote(remote) def fetch_remote(remote, forced: false, no_tags: false)
gitlab_shell.fetch_remote(path_with_namespace, remote) gitlab_shell.fetch_remote(path_with_namespace, remote, forced: forced, no_tags: no_tags)
end end
def fetch_remote_forced!(remote) def fetch_remote_forced!(remote)
......
...@@ -7,7 +7,7 @@ module Projects ...@@ -7,7 +7,7 @@ module Projects
@errors = [] @errors = []
begin begin
repository.fetch_remote(mirror.ref_name) repository.fetch_remote(mirror.ref_name, no_tags: true)
if divergent_branches.present? if divergent_branches.present?
errors << "The following branches have diverged from their local counterparts: #{divergent_branches.to_sentence}" errors << "The following branches have diverged from their local counterparts: #{divergent_branches.to_sentence}"
......
...@@ -50,9 +50,11 @@ module Gitlab ...@@ -50,9 +50,11 @@ module Gitlab
# Ex. # Ex.
# fetch_remote("gitlab/gitlab-ci", "upstream") # fetch_remote("gitlab/gitlab-ci", "upstream")
# #
def fetch_remote(name, remote, forced: false) def fetch_remote(name, remote, forced: false, no_tags: false)
args = [gitlab_shell_projects_path, 'fetch-remote', "#{name}.git", remote, '600'] args = [gitlab_shell_projects_path, 'fetch-remote', "#{name}.git", remote, '600']
args << '--force' if forced args << '--force' if forced
args << '--no-tags' if no_tags
output, status = Popen::popen(args) output, status = Popen::popen(args)
raise Error, output unless status.zero? raise Error, output unless status.zero?
true true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment