summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-12-01 04:21:58 +0000
committerDouwe Maan <douwe@gitlab.com>2016-12-01 04:21:58 +0000
commitdcfc86086dbc5d38a09b4710222e74c1b1a5dcba (patch)
tree19014d95f903e6df72f4fec470be7e34671dbdef
parentd7428a5a88ba4e204e0d1c6a9b6c12c070a41c8f (diff)
parent2bca5ccbfc6e35b9852ca5af117744d3a9a45422 (diff)
downloadgitlab-shell-dcfc86086dbc5d38a09b4710222e74c1b1a5dcba.tar.gz
Merge branch 'add-prune-option-to-fetch-command' into 'master'
Fetch repositories with --prune option by default. This will allow us to not recreate branches that has been deleted on the upstream and the mirror. Related issue: https://gitlab.com/gitlab-org/gitlab-ee/issues/1277 I've reviewed the code for updating local and remote mirrors also I've manually tested these features and all looks good. Here is the description of the `--prune` option: >>> --prune Before fetching, remove any remote-tracking references that no longer exist on the remote. Tags are not subject to pruning if they are fetched only because of the default tag auto-following or due to a --tags option. However, if tags are fetched due to an explicit refspec (either on the command line or in the remote configuration, for example if the remote was cloned with the --mirror option), then they are also subject to >>> @brodock do you see any issues when fetching repos for GitLab Geo? See merge request !110
-rw-r--r--CHANGELOG2
-rw-r--r--lib/gitlab_projects.rb1
2 files changed, 3 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 10695fc..e520a99 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+v4.0.3
+ - Fetch repositories with `--prune` option by default
v4.0.2
- Fix gitlab_custom_hook dependencies
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index 60addc7..505b49e 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -205,6 +205,7 @@ class GitlabProjects
$logger.info "Fetching remote #{@name} for project #{@project_name}."
cmd = %W(git --git-dir=#{full_path} fetch #{@name})
+ cmd << '--prune'
cmd << '--force' if forced
cmd << tags_option
pid = Process.spawn(*cmd)