blob: 5cfb4d5b8f3977312ce72d76c08d1c12f7999cf7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# Test single_branch parameter
- name: SINGLE_BRANCH | clear checkout_dir
file:
state: absent
path: "{{ checkout_dir }}"
- name: SINGLE_BRANCH | Clone example git repo using single_branch
git:
repo: 'file://{{ repo_dir|expanduser }}/shallow_branches'
dest: '{{ checkout_dir }}'
single_branch: yes
register: single_branch_1
- name: SINGLE_BRANCH | Clone example git repo using single_branch again
git:
repo: 'file://{{ repo_dir|expanduser }}/shallow_branches'
dest: '{{ checkout_dir }}'
single_branch: yes
register: single_branch_2
- name: SINGLE_BRANCH | List revisions
command: git rev-list --all --count
args:
chdir: '{{ checkout_dir }}'
register: rev_list1
when: git_version.stdout is version(git_version_supporting_single_branch, '>=')
- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git >= {{ git_version_supporting_single_branch }}
assert:
that:
- single_branch_1 is changed
- single_branch_2 is not changed
when: git_version.stdout is version(git_version_supporting_single_branch, '>=')
- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git < {{ git_version_supporting_single_branch }}
assert:
that:
- single_branch_1 is changed
- single_branch_1.warnings | length == 1
- single_branch_2 is not changed
when: git_version.stdout is version(git_version_supporting_single_branch, '<')
- name: SINGLE_BRANCH | clear checkout_dir
file:
state: absent
path: "{{ checkout_dir }}"
- name: SINGLE_BRANCH | Clone example git repo using single_branch with version
git:
repo: 'file://{{ repo_dir|expanduser }}/shallow_branches'
dest: '{{ checkout_dir }}'
single_branch: yes
version: master
register: single_branch_3
- name: SINGLE_BRANCH | Clone example git repo using single_branch with version again
git:
repo: 'file://{{ repo_dir|expanduser }}/shallow_branches'
dest: '{{ checkout_dir }}'
single_branch: yes
version: master
register: single_branch_4
- name: SINGLE_BRANCH | List revisions
command: git rev-list --all --count
args:
chdir: '{{ checkout_dir }}'
register: rev_list2
when: git_version.stdout is version(git_version_supporting_single_branch, '>=')
- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git >= {{ git_version_supporting_single_branch }}
assert:
that:
- single_branch_3 is changed
- single_branch_4 is not changed
- rev_list2.stdout == '1'
when: git_version.stdout is version(git_version_supporting_single_branch, '>=')
- name: SINGLE_BRANCH | Ensure single_branch did the right thing with git < {{ git_version_supporting_single_branch }}
assert:
that:
- single_branch_3 is changed
- single_branch_3.warnings | length == 1
- single_branch_4 is not changed
when: git_version.stdout is version(git_version_supporting_single_branch, '<')
|