summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/project.rb4
-rw-r--r--lib/gitlab/backend/shell.rb13
3 files changed, 4 insertions, 14 deletions
diff --git a/CHANGELOG b/CHANGELOG
index df4c3ead6ee..8c0e0f2f0d3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -42,6 +42,7 @@ v 8.7.0 (unreleased)
- Add default scope to projects to exclude projects pending deletion
- Allow to close merge requests which source projects(forks) are deleted.
- Ensure empty recipients are rejected in BuildsEmailService
+ - Use rugged to change HEAD in Project#change_head (P.S.V.R)
- API: Ability to filter milestones by state `active` and `closed` (Robert Schilling)
- API: Fix milestone filtering by `iid` (Robert Schilling)
- API: Delete notes of issues, snippets, and merge requests (Robert Schilling)
diff --git a/app/models/project.rb b/app/models/project.rb
index fadc8bb2c9e..c4b0e484347 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -865,7 +865,9 @@ class Project < ActiveRecord::Base
def change_head(branch)
repository.before_change_head
- gitlab_shell.update_repository_head(self.path_with_namespace, branch)
+ repository.rugged.references.create('HEAD',
+ "refs/heads/#{branch}",
+ force: true)
reload_default_branch
end
diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb
index 4ceea2ab221..5e2fb863a8f 100644
--- a/lib/gitlab/backend/shell.rb
+++ b/lib/gitlab/backend/shell.rb
@@ -54,19 +54,6 @@ module Gitlab
"#{path}.git", "#{new_path}.git"])
end
- # Update HEAD for repository
- #
- # path - project path with namespace
- # branch - repository branch name
- #
- # Ex.
- # update_repository_head("gitlab/gitlab-ci", "3-1-stable")
- #
- def update_repository_head(path, branch)
- Gitlab::Utils.system_silent([gitlab_shell_projects_path, 'update-head',
- "#{path}.git", branch])
- end
-
# Fork repository to new namespace
#
# path - project path with namespace