summaryrefslogtreecommitdiff
path: root/qa/qa/git/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/git/repository.rb')
-rw-r--r--qa/qa/git/repository.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb
index 0f7e4fbbc97..24a148e9330 100644
--- a/qa/qa/git/repository.rb
+++ b/qa/qa/git/repository.rb
@@ -14,7 +14,7 @@ module QA
include Support::Run
attr_writer :use_lfs, :gpg_key_id
- attr_accessor :env_vars
+ attr_accessor :env_vars, :default_branch
InvalidCredentialsError = Class.new(RuntimeError)
@@ -25,6 +25,7 @@ module QA
self.env_vars = [%Q{HOME="#{tmp_home_dir}"}]
@use_lfs = false
@gpg_key_id = nil
+ @default_branch = Runtime::Env.default_branch
end
def self.perform(*args)
@@ -123,7 +124,7 @@ module QA
run_git("git rev-parse --abbrev-ref HEAD").to_s
end
- def push_changes(branch = 'master', push_options: nil)
+ def push_changes(branch = @default_branch, push_options: nil)
cmd = ['git push']
cmd << push_options_hash_to_string(push_options)
cmd << uri
@@ -209,6 +210,13 @@ module QA
File.delete(netrc_file_path) if File.exist?(netrc_file_path)
end
+ def remote_branches
+ # This gets the remote branch names
+ # When executed on a fresh repo it returns the default branch name
+
+ run_git('git --no-pager branch --list --remotes --format="%(refname:lstrip=3)"').to_s.split("\n")
+ end
+
private
attr_reader :uri, :username, :password, :ssh, :use_lfs