summaryrefslogtreecommitdiff
path: root/qa/qa/git
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/git
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/git')
-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