summaryrefslogtreecommitdiff
path: root/qa/qa/resource/repository/push.rb
diff options
context:
space:
mode:
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