@ -171,3 +171,54 @@
file:
state : absent
path : "{{ checkout_dir }}"
#
# Make sure shallow fetch works when switching to (fetching) a new a branch
#
- name : DEPTH | clone from branch with depth specified
git:
repo : 'file://{{ repo_dir|expanduser }}/shallow_branches'
dest : '{{ checkout_dir }}'
depth : 1
version : test_branch
- name : DEPTH | check if clone is shallow
stat : path={{ checkout_dir }}/.git/shallow
register : is_shallow
when : git_version.stdout is version(git_version_supporting_depth, '>=')
- name : DEPTH | assert that clone is shallow
assert:
that:
- is_shallow.stat.exists
when : git_version.stdout is version(git_version_supporting_depth, '>=')
- name : DEPTH | switch to new branch (fetch) with the shallow clone
git:
repo : 'file://{{ repo_dir|expanduser }}/shallow_branches'
dest : '{{ checkout_dir }}'
depth : 1
version : new_branch
register : git_fetch
- name : DEPTH | assert if switching a shallow clone to a new branch worked
assert:
that:
- git_fetch is changed
- name : DEPTH | check if clone is still shallow
stat : path={{ checkout_dir }}/.git/shallow
register : is_shallow
when : git_version.stdout is version(git_version_supporting_depth, '>=')
- name : DEPTH | assert that clone still is shallow
assert:
that:
- is_shallow.stat.exists
when : git_version.stdout is version(git_version_supporting_depth, '>=')
- name : DEPTH | clear checkout_dir
file:
state : absent
path : "{{ checkout_dir }}"