Commit 413cb0af authored by Gabriel Mazetto's avatar Gabriel Mazetto

git fetch --force using gitlab-shell instead

parent baa48794
...@@ -196,8 +196,7 @@ class Repository ...@@ -196,8 +196,7 @@ class Repository
end end
def fetch_remote_forced!(remote) def fetch_remote_forced!(remote)
args = %W(#{Gitlab.config.git.bin_path} fetch #{remote} -f) gitlab_shell.fetch_remote(path_with_namespace, remote, true)
Gitlab::Popen.popen(args, path_to_repo)
end end
def branch_names def branch_names
......
...@@ -45,12 +45,15 @@ module Gitlab ...@@ -45,12 +45,15 @@ module Gitlab
# #
# name - project path with namespace # name - project path with namespace
# remote - remote name # remote - remote name
# forced - should we use --force flag?
# #
# Ex. # Ex.
# fetch_remote("gitlab/gitlab-ci", "upstream") # fetch_remote("gitlab/gitlab-ci", "upstream")
# #
def fetch_remote(name, remote) def fetch_remote(name, remote, forced=false)
output, status = Popen::popen([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
output, status = Popen::popen(args)
raise Error, output unless status.zero? raise Error, output unless status.zero?
true true
end end
......
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