Debian Codegraph @

test/integration/targets/git/tasks/single-branch.yml

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