summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-15 11:48:19 +0200
committerRémy Coutable <remy@rymai.me>2016-04-15 11:48:19 +0200
commit804d20742f9ccec997aad72ed0d678c5ac57c8c9 (patch)
treed7d6bfdfcb5797790d00a026e699a99f0f909c31
parentc615ca4650dfb4b17bf073276024f886e52b74a3 (diff)
downloadgitlab-shell-remove-update-head.tar.gz
Remove the update-head command since GitLab doesn't use it anymoreremove-update-head
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--CHANGELOG4
-rw-r--r--README.md4
-rwxr-xr-xbin/gitlab-projects2
-rw-r--r--lib/gitlab_projects.rb17
-rw-r--r--spec/gitlab_projects_spec.rb27
5 files changed, 4 insertions, 50 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 69a330f..adab7d8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
+v3.0.0
+ - Remove update-head command
+
v2.7.1
- Add new command to list tags from a remote repo
- Add the ability to fetch remote repo with or without tags
+
v2.7.0
- Add support for ssh AuthorizedKeysCommand query by key
diff --git a/README.md b/README.md
index 027e1e6..874d7d6 100644
--- a/README.md
+++ b/README.md
@@ -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 branch:
./bin/gitlab-projects create-branch gitlab/gitlab-ci.git 3-2-stable master
diff --git a/bin/gitlab-projects b/bin/gitlab-projects
index c354fe5..22b0022 100755
--- a/bin/gitlab-projects
+++ b/bin/gitlab-projects
@@ -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
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index 9276344..fc9f4bb 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -61,7 +61,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
@@ -336,22 +335,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)
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index 50af42f..072c2a9 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -258,33 +258,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') }