Commit 9bf99423 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)

Merge branch 'remove-update-head' into 'master'

Remove the update-head command since GitLab doesn't use it anymore

It looks like we tend to remove commands that are not used by GitLab anymore (see gitlab-org/gitlab-shell!26) and the `update-head` command will soon be in that case (see https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3705), so I think we should remove it from here too.

Note: I'm setting this as a WIP to ensure this doesn't get merged since the GitLab MR is not merged at that moment.

See merge request !51
parents 3f942ef5 1f0a77ca
......@@ -2,6 +2,7 @@ v3.0.0
- Remove rm-tag command (Robert Schilling)
- Remove create-branch and rm-branch commands (Robert Schilling)
- Update PostReceive worker so it logs a unique JID in Sidekiq
- Remove update-head command
v2.7.2
- Do not prune objects during 'git gc'
......
......@@ -100,10 +100,6 @@ Fork repo:
./bin/gitlab-projects fork-project gitlab/gitlab-ci.git randx
Update HEAD:
./bin/gitlab-projects update-head gitlab/gitlab-ci.git 3-2-stable
Create tag (lightweight & annotated):
./bin/gitlab-projects create-tag gitlab/gitlab-ci.git v3.0.0 3-0-stable
......
......@@ -19,8 +19,6 @@ require_relative '../lib/gitlab_init'
#
# /bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git
#
# /bin/gitlab-projects update-head gitlab/gitlab-ci.git 5-2-stable
#
require File.join(ROOT_PATH, 'lib', 'gitlab_projects')
# Return non-zero if command execution was not successful
......
......@@ -58,7 +58,6 @@ class GitlabProjects
when 'import-project'; import_project
when 'fork-project'; fork_project
when 'fetch-remote'; fetch_remote
when 'update-head'; update_head
when 'push-branches'; push_branches
when 'delete-remote-branches'; delete_remote_branches
when 'list-remote-tags'; list_remote_tags
......@@ -314,22 +313,6 @@ class GitlabProjects
system(*cmd) && self.class.create_hooks(full_destination_path)
end
def update_head
new_head = ARGV.shift
unless new_head
$logger.error "update-head failed: no branch provided."
return false
end
File.open(File.join(full_path, 'HEAD'), 'w') do |f|
f.write("ref: refs/heads/#{new_head}")
end
$logger.info "Update head in project #{project_name} to <#{new_head}>."
true
end
def gc
$logger.info "Running git gc for <#{full_path}>."
unless File.exists?(full_path)
......
......@@ -205,33 +205,6 @@ describe GitlabProjects do
end
end
describe :update_head do
let(:gl_projects) { build_gitlab_projects('update-head', repo_name, 'stable') }
let(:gl_projects_fail) { build_gitlab_projects 'update-head', repo_name }
before do
FileUtils.mkdir_p(tmp_repo_path)
system(*%W(git init --bare #{tmp_repo_path}))
FileUtils.touch(File.join(tmp_repo_path, "refs/heads/stable"))
File.read(File.join(tmp_repo_path, 'HEAD')).strip.should == 'ref: refs/heads/master'
end
it "should update head for repo" do
gl_projects.exec.should be_true
File.read(File.join(tmp_repo_path, 'HEAD')).strip.should == 'ref: refs/heads/stable'
end
it "should log an update_head event" do
$logger.should_receive(:info).with("Update head in project #{repo_name} to <stable>.")
gl_projects.exec
end
it "should failed and log an error" do
$logger.should_receive(:error).with("update-head failed: no branch provided.")
gl_projects_fail.exec.should be_false
end
end
describe :import_project do
context 'success import' do
let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') }
......
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