summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/git/tasks/ambiguous-ref.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
commit8a754e0858d922e955e71b253c139e071ecec432 (patch)
tree527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/git/tasks/ambiguous-ref.yml
parentInitial commit. (diff)
downloadansible-core-upstream.tar.xz
ansible-core-upstream.zip
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/git/tasks/ambiguous-ref.yml')
-rw-r--r--test/integration/targets/git/tasks/ambiguous-ref.yml37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/integration/targets/git/tasks/ambiguous-ref.yml b/test/integration/targets/git/tasks/ambiguous-ref.yml
new file mode 100644
index 0000000..f06112e
--- /dev/null
+++ b/test/integration/targets/git/tasks/ambiguous-ref.yml
@@ -0,0 +1,37 @@
+# test for https://github.com/ansible/ansible-modules-core/pull/3386
+
+- name: AMBIGUOUS-REF | clone repo
+ git:
+ repo: '{{ repo_format1 }}'
+ dest: '{{ checkout_dir }}'
+
+- name: AMBIGUOUS-REF | rename remote to be ambiguous
+ command: git remote rename origin v0.1
+ args:
+ chdir: "{{ checkout_dir }}"
+
+- name: AMBIGUOUS-REF | switch to HEAD
+ git:
+ repo: '{{ repo_format1 }}'
+ dest: '{{ checkout_dir }}'
+ remote: v0.1
+
+- name: AMBIGUOUS-REF | rev-parse remote HEAD
+ command: git rev-parse v0.1/HEAD
+ args:
+ chdir: "{{ checkout_dir }}"
+ register: git_remote_head
+
+- name: AMBIGUOUS-REF | rev-parse local HEAD
+ command: git rev-parse HEAD
+ args:
+ chdir: "{{ checkout_dir }}"
+ register: git_local_head
+
+- assert:
+ that: git_remote_head.stdout == git_local_head.stdout
+
+- name: AMBIGUOUS-REF | clear checkout_dir
+ file:
+ state: absent
+ path: "{{ checkout_dir }}"