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'