summaryrefslogtreecommitdiff
path: root/qa/qa/resource/repository/push.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 11:59:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 11:59:07 +0000
commit8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch)
tree544930fb309b30317ae9797a9683768705d664c4 /qa/qa/resource/repository/push.rb
parent4b1de649d0168371549608993deac953eb692019 (diff)
downloadgitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'qa/qa/resource/repository/push.rb')
-rw-r--r--qa/qa/resource/repository/push.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/qa/qa/resource/repository/push.rb b/qa/qa/resource/repository/push.rb
index 5266f8b9bea..f5b6040d927 100644
--- a/qa/qa/resource/repository/push.rb
+++ b/qa/qa/resource/repository/push.rb
@@ -17,7 +17,6 @@ module QA
@file_name = "file-#{SecureRandom.hex(8)}.txt"
@file_content = '# This is test file'
@commit_message = "This is a test commit"
- @branch_name = 'master'
@new_branch = true
@repository_http_uri = ""
@ssh_key = nil
@@ -78,6 +77,8 @@ module QA
@output += repository.clone
repository.configure_identity(name, email)
+ @branch_name ||= default_branch(repository)
+
@output += repository.checkout(branch_name, new_branch: new_branch)
if @tag_name
@@ -105,6 +106,10 @@ module QA
private
+ def default_branch(repository)
+ repository.remote_branches.last || Runtime::Env.default_branch
+ end
+
def commit_to(repository)
@gpg_key_id.nil? ? repository.commit(@commit_message) : repository.commit_with_gpg(@commit_message)
end