diff options
author | Robert Speicher <robert@gitlab.com> | 2017-04-04 00:26:41 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-04-04 00:26:41 +0300 |
commit | d9aca741155f456711e37ea68a28a46d349af698 (patch) | |
tree | 96967336d0e3387de1d261517537e6b0196b9f97 /lib/gitlab/shell.rb | |
parent | e473a90700cad4dea6c883122f793b5d6453c7c8 (diff) | |
parent | a9af86250c5226505ccce03f4e4aae08fe976be7 (diff) |
Merge branch 'fix-github-importer-slowness' into 'master'
Improve performance of GitHub importer
Closes #28183
See merge request !10273
Diffstat (limited to 'lib/gitlab/shell.rb')
-rw-r--r-- | lib/gitlab/shell.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 9864a9c7f1a..b631ef11ce7 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -88,6 +88,26 @@ module Gitlab true end + # Fetch remote for repository + # + # name - project path with namespace + # remote - remote name + # forced - should we use --force flag? + # no_tags - should we use --no-tags flag? + # + # Ex. + # fetch_remote("gitlab/gitlab-ci", "upstream") + # + def fetch_remote(storage, name, remote, forced: false, no_tags: false) + args = [gitlab_shell_projects_path, 'fetch-remote', storage, "#{name}.git", remote, '800'] + args << '--force' if forced + args << '--no-tags' if no_tags + + output, status = Popen.popen(args) + raise Error, output unless status.zero? + true + end + # Move repository # storage - project's storage path # path - project path with namespace |