Debian Codegraph @

test/integration/targets/git/tasks/setup-local-repos.yml

raw
1 - name: SETUP-LOCAL-REPOS | create dirs
2 file:
3 name: "{{ item }}"
4 state: directory
5 with_items:
6 - "{{ repo_dir }}/minimal"
7 - "{{ repo_dir }}/shallow"
8 - "{{ repo_dir }}/shallow_branches"
9 - "{{ repo_dir }}/tag_force_push"
10
11 - name: SETUP-LOCAL-REPOS | prepare minimal git repo
12 shell: |
13 set -eEu
14
15 git init
16
17 echo "1" > a
18 git add a
19 git commit -m "1"
20 args:
21 chdir: "{{ repo_dir }}/minimal"
22
23 - name: SETUP-LOCAL-REPOS | prepare git repo for shallow clone
24 shell: |
25 set -eEu
26
27 git init
28
29 echo "1" > a
30 git add a
31 git commit -m "1"
32 git tag earlytag
33 git branch earlybranch
34
35 echo "2" > a
36 git add a
37 git commit -m "2"
38 args:
39 chdir: "{{ repo_dir }}/shallow"
40
41 - name: SETUP-LOCAL-REPOS | set old hash var for shallow test
42 command: 'git rev-parse HEAD~1'
43 register: git_shallow_head_1
44 args:
45 chdir: "{{ repo_dir }}/shallow"
46
47 - name: SETUP-LOCAL-REPOS | prepare tmp git repo with two branches
48 shell: |
49 set -eEu
50
51 git init
52
53 echo "1" > a; git add a; git commit -m "1"
54 git checkout -b test_branch; echo "2" > a; git commit -m "2 on branch" a
55 git checkout -b new_branch; echo "3" > a; git commit -m "3 on new branch" a
56 args:
57 chdir: "{{ repo_dir }}/shallow_branches"
58
59 - name: SETUP-LOCAL-REPOS | get ref head for test_branch
60 shell: git checkout test_branch && git rev-parse HEAD
61 args:
62 chdir: "{{ repo_dir }}/shallow_branches"
63 register: ref_head_id
64
65 - name: SETUP-LOCAL-REPOS | store ref head for test_branch
66 set_fact:
67 test_branch_ref_head_id: "{{ ref_head_id.stdout }}"
68
69 # Make this a bare one, we need to be able to push to it from clones
70 # We make the repo here for consistency with the other repos,
71 # but we finish setting it up in forcefully-fetch-tag.yml.
72 - name: SETUP-LOCAL-REPOS | prepare tag_force_push git repo
73 shell: |
74 set -eEu
75
76 git init --bare
77 args:
78 chdir: "{{ repo_dir }}/tag_force_push"