---

- name: initial checkout
  git:
    repo: "{{ repo_format1 }}"
    dest: "{{ repo_dir }}/format1"
  register: git_result

- name: verify information about the initial clone
  assert:
    that:
      - "'before' in git_result"
      - "'after' in git_result"
      - "not git_result.before"
      - "git_result.changed"

- name: repeated checkout
  git:
    repo: "{{ repo_format1 }}"
    dest: "{{ repo_dir }}/format1"
  register: git_result2

- name: check for tags
  stat:
    path: "{{ repo_dir }}/format1/.git/refs/tags"
  register: tags

- name: check for HEAD
  stat:
    path: "{{ repo_dir }}/format1/.git/HEAD"
  register: head

- name: assert presence of tags/trunk/branches
  assert:
    that:
      - "tags.stat.isdir"
      - "head.stat.isreg"

- name: verify on a reclone things are marked unchanged
  assert:
    that:
      - "not git_result2.changed"