---
- name: Fetch OpenXLA from git
  when: openxla_version == 'git'
  ansible.builtin.git:
    repo: "https://github.com/openxla/xla.git"  # noqa latest[git]
    dest: "{{ xla_build_dir }}/"
    depth: 1
    recursive: true
    force: true

- name: Prepare OpenXLA source from git
  when: openxla_version == 'git'
  block:
    - name: Set world write access to source
      ansible.builtin.file:
        path: "{{ xla_build_dir }}/"
        state: directory
        mode: 0777

    - name: Get oneline version of git log for this checkout  # noqa no-changed-when
      ansible.builtin.command:
        cmd: "git log --pretty=oneline -1"
        chdir: "{{ xla_build_dir }}/"
      register: git_log

    - name: Show git log
      ansible.builtin.debug:
        var: git_log.stdout
