You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/git/tasks/specific-rev-diff-check.yml

50 lines
1.4 KiB
YAML

# Test that diff is displayed together with check mode in a shallow clone
# when checking out a specific revision
- name: SPECIFIC-REV-DIFF-CHECK | clear checkout_dir
file:
state: absent
path: '{{ checkout_dir }}'
- name: SPECIFIC-REVISION-DIFF-CHECK | shallow clone
git:
repo: "{{ repo_dir }}/shallow_branches/.git"
dest: "{{ checkout_dir }}/ansible-repo"
update: true
version: "main"
depth: 1
- name: SPECIFIC-REVISION-DIFF-CHECK | check mode with diff mode specific sha bad object
git:
repo: "{{ repo_dir }}/shallow_branches/.git"
dest: "{{ checkout_dir }}/ansible-repo"
depth: 1
update: true
version: '"{{ test_branch_ref_head_id }}"'
check_mode: true
diff: true
register: git_result
- assert:
that:
- "'>> Failed to get proper diff between' in git_result.diff.prepared"
- "'>> fatal: bad object' in git_result.diff.prepared"
- name: SPECIFIC-REVISION-DIFF-CHECK | check and diff mode with refspec force checkout old commit sha
git:
repo: "{{ repo_dir }}/shallow_branches/.git"
dest: "{{ checkout_dir }}/ansible-repo"
depth: 1
update: true
force: true
version: "{{ test_branch_ref_head_id }}"
refspec: "{{ test_branch_ref_head_id }}:refs/remotes/origin/devel"
check_mode: true
diff: true
register: git_result
- assert:
that:
- "'diff --git a' in git_result.diff.prepared"
- 'git_result.after == "{{ test_branch_ref_head_id }}"'