As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 362ab1a8 authored by TJ (Thomas) Biddle's avatar TJ (Thomas) Biddle Committed by TJ Biddle
Browse files

Support Adding and Removing of branches and tags

This commit adds support to create and remove branches and tags from gitlab-shell.

The code style was followed as closely as possible to the original.

The purpose of this commit is that I will be adding support to the Gitlabhq (Gitlab) project
in order to allow adding and removing of branches and tags through their API.
parent 5519420e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -25,6 +25,10 @@ class GitlabProjects
def exec
case @command
when 'create-branch'; create_branch
when 'rm-branch'; rm_branch
when 'create-tag'; create_tag
when 'rm-tag'; rm_tag
when 'add-project'; add_project
when 'rm-project'; rm_project
when 'mv-project'; mv_project
Loading
Loading
@@ -38,6 +42,32 @@ class GitlabProjects
protected
def create_branch
branch_name = ARGV.shift
ref = ARGV.shift || "HEAD"
cmd = "cd #{full_path} && git branch #{branch_name} #{ref}"
system(cmd)
end
def rm_branch
branch_name = ARGV.shift
cmd = "cd #{full_path} && git branch -D #{branch_name}"
system(cmd)
end
def create_tag
tag_name = ARGV.shift
ref = ARGV.shift || "HEAD"
cmd = "cd #{full_path} && git tag #{tag_name} #{ref}"
system(cmd)
end
def rm_tag
tag_name = ARGV.shift
cmd = "cd #{full_path} && git tag -d #{tag_name}"
system(cmd)
end
def add_project
FileUtils.mkdir_p(full_path, mode: 0770)
cmd = "cd #{full_path} && git init --bare && #{create_hooks_cmd}"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment