From bcb22b0e1a208ce6c978f893f7a757129c61ad5e Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 11 Jan 2016 17:16:08 -0800 Subject: [PATCH] Integration tests for https://github.com/ansible/ansible-modules-core/pull/558 --- .../integration/roles/test_git/tasks/main.yml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/integration/roles/test_git/tasks/main.yml b/test/integration/roles/test_git/tasks/main.yml index 46f6e078ee1..49f5f53bfb8 100644 --- a/test/integration/roles/test_git/tasks/main.yml +++ b/test/integration/roles/test_git/tasks/main.yml @@ -386,3 +386,29 @@ - name: assert presence of new file in repo (i.e. working copy updated) assert: that: "repo_content.stat.exists" + +# Test that checkout by branch works when the branch is not in our current repo but the sha is + +- name: clear checkout_dir + file: state=absent path={{ checkout_dir }} + +- name: Clone example git repo that we're going to modify + git: + repo: '{{ repo_update_url_1 }}' + dest: '{{ checkout_dir }}/repo' + +- name: Clone the repo again - this is what we test + git: + repo: '{{ checkout_dir }}/repo' + dest: '{{ checkout_dir }}/checkout' + +- name: Add a branch to the repo + command: git branch new-branch + args: + chdir: '{{ checkout_dir }}/repo' + +- name: Checkout the new branch in the checkout + git: + repo: '{{ checkout_dir}}/repo' + version: 'new-branch' + dest: '{{ checkout_dir }}/checkout'