Skip to content
代码片段 群组 项目
未验证 提交 5d3719b7 编辑于 作者: Dylan Griffith's avatar Dylan Griffith 提交者: GitLab
浏览文件

Merge branch 'dont-checkout-master-in-gitlab-housekeeper-git' into 'master'

Don't checkout master when running gitlab-housekeeper

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/150259



Merged-by: default avatarDylan Griffith <dyl.griffith@gmail.com>
Approved-by: default avatarDylan Griffith <dyl.griffith@gmail.com>
Co-authored-by: default avatarRémy Coutable <remy@rymai.me>
No related branches found
No related tags found
无相关合并请求
......@@ -15,21 +15,17 @@ def initialize(logger:, branch_from: 'master')
@branch_from = branch_from
end
def with_clean_state
def with_clean_state(&block)
result = Shell.execute('git', 'stash')
stashed = !result.include?('No local changes to save')
with_return_to_current_branch(stashed: stashed) do
checkout_branch(@branch_from)
yield
end
with_return_to_current_branch(stashed: stashed, &block)
end
def create_branch(change)
branch_name = branch_name(change.identifiers)
Shell.execute("git", "branch", "-f", branch_name)
Shell.execute("git", "branch", "-f", branch_name, @branch_from)
branch_name
end
......
......@@ -68,9 +68,9 @@ def run
# If no merge request exists yet, create an empty one to allow keeps to use the web URL.
unless @dry_run
merge_reqeust = get_existing_merge_request(branch_name) || create(change, branch_name)
merge_request = get_existing_merge_request(branch_name) || create(change, branch_name)
change.mr_web_url = merge_reqeust['web_url']
change.mr_web_url = merge_request['web_url']
end
git.in_branch(branch_name) do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册