From e8b1c4e14a6a69efc71382e7789d4368707b8e28 Mon Sep 17 00:00:00 2001 From: Robin Roth Date: Tue, 19 Apr 2016 16:00:45 +0200 Subject: [PATCH] add test for git with both depth and version arguments (#15471) * add test for ansible/ansible-modules-core#3456 combination of options version and depth * add test of switching to older branch --- .../integration/roles/test_git/tasks/main.yml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test/integration/roles/test_git/tasks/main.yml b/test/integration/roles/test_git/tasks/main.yml index 792dd0dc3b..18eaeffdfe 100644 --- a/test/integration/roles/test_git/tasks/main.yml +++ b/test/integration/roles/test_git/tasks/main.yml @@ -559,6 +559,55 @@ - "'newtag' in listoftags.stdout_lines" +- name: clear checkout_dir + file: state=absent path={{ checkout_dir }} + + + # Test for https://github.com/ansible/ansible-modules-core/issues/3456 + # clone a repo with depth and version specified + +- name: clone repo with both version and depth specified + git: + repo: '{{ repo_depth_url }}' + dest: '{{ checkout_dir }}' + depth: 1 + version: master + +- name: run a second time (now fetch, not clone) + git: + repo: '{{ repo_depth_url }}' + dest: '{{ checkout_dir }}' + depth: 1 + version: master + register: git_fetch + +- name: ensure the fetch succeeded + assert: + that: git_fetch|success + + +- name: clear checkout_dir + file: state=absent path={{ checkout_dir }} + +- name: clone repo with both version and depth specified + git: + repo: '{{ repo_depth_url }}' + dest: '{{ checkout_dir }}' + depth: 1 + version: master + +- name: switch to older branch with depth=1 (uses fetch) + git: + repo: '{{ repo_depth_url }}' + dest: '{{ checkout_dir }}' + depth: 1 + version: earlybranch + register: git_fetch + +- name: ensure the fetch succeeded + assert: + that: git_fetch|success + - name: clear checkout_dir file: state=absent path={{ checkout_dir }}