summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qa/qa/factory/repository/push.rb7
-rw-r--r--qa/qa/git/repository.rb4
-rw-r--r--qa/qa/specs/features/project/deploy_key_clone_spec.rb1
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)