Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-03-02 16:50:17 +0300
committerStan Hu <stanhu@gmail.com>2018-03-06 11:10:04 +0300
commite9fad3e501f6c8fa7ebc58011e5bf9fff379617e (patch)
treec30dfebb3a9e9afd1e9884f56117411c34ae35d9 /app/models/repository.rb
parent2e87923dcb1cf7984690f5b5fdfc61bddfba923e (diff)
Make --prune a configurable parameter in fetching a git remote
By default, --prune is added to the command-line of a `git fetch` operation, but for repositories with many references this can take a long time to run. We shouldn't need to run --prune the first time we fetch a new repository.
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 1a14afb951a..e6b88320110 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -866,20 +866,20 @@ class Repository
raw_repository.ancestor?(ancestor_id, descendant_id)
end
- def fetch_as_mirror(url, forced: false, refmap: :all_refs, remote_name: nil)
+ def fetch_as_mirror(url, forced: false, refmap: :all_refs, remote_name: nil, prune: true)
unless remote_name
remote_name = "tmp-#{SecureRandom.hex}"
tmp_remote_name = true
end
add_remote(remote_name, url, mirror_refmap: refmap)
- fetch_remote(remote_name, forced: forced)
+ fetch_remote(remote_name, forced: forced, prune: prune)
ensure
remove_remote(remote_name) if tmp_remote_name
end
- def fetch_remote(remote, forced: false, ssh_auth: nil, no_tags: false)
- gitlab_shell.fetch_remote(raw_repository, remote, ssh_auth: ssh_auth, forced: forced, no_tags: no_tags)
+ def fetch_remote(remote, forced: false, ssh_auth: nil, no_tags: false, prune: true)
+ gitlab_shell.fetch_remote(raw_repository, remote, ssh_auth: ssh_auth, forced: forced, no_tags: no_tags, prune: prune)
end
def fetch_source_branch!(source_repository, source_branch, local_ref)