diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-04-03 22:47:46 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-04-03 22:47:46 +0800 |
commit | 353c5782b47211f9a7e2439189b23dde8678960a (patch) | |
tree | c1dbce701d7fc5bde3eec9d2274b53c89bbba258 /qa | |
parent | 1fe57d3f01f8fc7a6f0f71e63d0562512d1e5506 (diff) | |
download | gitlab-ce-353c5782b47211f9a7e2439189b23dde8678960a.tar.gz |
Checkout to a new branch
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/factory/repository/push.rb | 7 | ||||
-rw-r--r-- | qa/qa/git/repository.rb | 4 | ||||
-rw-r--r-- | qa/qa/specs/features/project/deploy_key_clone_spec.rb | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/qa/qa/factory/repository/push.rb b/qa/qa/factory/repository/push.rb index 6e8905cde78..bd4dee4c7be 100644 --- a/qa/qa/factory/repository/push.rb +++ b/qa/qa/factory/repository/push.rb @@ -30,7 +30,12 @@ module QA repository.clone repository.configure_identity('GitLab QA', 'root@gitlab.com') - repository.checkout(@branch_name) unless @new_branch + if @new_branch + repository.checkout_new_branch(@branch_name) + else + repository.checkout(@branch_name) + end + repository.add_file(@file_name, @file_content) repository.commit(@commit_message) repository.push_changes(@branch_name) diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb index b3150e8f3fa..4ffe25304a1 100644 --- a/qa/qa/git/repository.rb +++ b/qa/qa/git/repository.rb @@ -40,6 +40,10 @@ module QA `git checkout "#{branch_name}"` end + def checkout_new_branch(branch_name) + `git checkout -b "#{branch_name}"` + end + def shallow_clone clone('--depth 1') end diff --git a/qa/qa/specs/features/project/deploy_key_clone_spec.rb b/qa/qa/specs/features/project/deploy_key_clone_spec.rb index ba1c0375549..f193c77288d 100644 --- a/qa/qa/specs/features/project/deploy_key_clone_spec.rb +++ b/qa/qa/specs/features/project/deploy_key_clone_spec.rb @@ -74,6 +74,7 @@ module QA resource.commit_message = 'Add .gitlab-ci.yml' resource.file_content = gitlab_ci resource.branch_name = deploy_key_name + resource.new_branch = true end sha1sum = Digest::SHA1.hexdigest(gitlab_ci) |