mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
add newer syntax to detached HEAD check (#38879)
This commit is contained in:
parent
80d7e22f5e
commit
f072e6c15a
2 changed files with 12 additions and 1 deletions
|
@ -590,7 +590,7 @@ def is_local_branch(git_path, module, dest, branch):
|
||||||
def is_not_a_branch(git_path, module, dest):
|
def is_not_a_branch(git_path, module, dest):
|
||||||
branches = get_branches(git_path, module, dest)
|
branches = get_branches(git_path, module, dest)
|
||||||
for branch in branches:
|
for branch in branches:
|
||||||
if branch.startswith('* ') and ('no branch' in branch or 'detached from' in branch):
|
if branch.startswith('* ') and ('no branch' in branch or 'detached from' in branch or 'detached at' in branch):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,17 @@
|
||||||
that:
|
that:
|
||||||
- 'git_result.stdout == "4e739a34719654db7b04896966e2354e1256ea5d"'
|
- 'git_result.stdout == "4e739a34719654db7b04896966e2354e1256ea5d"'
|
||||||
|
|
||||||
|
- name: SPECIFIC-REVISION | update to HEAD from detached HEAD state
|
||||||
|
git:
|
||||||
|
repo: "{{ repo_dir }}/format1"
|
||||||
|
dest: "{{ checkout_dir }}"
|
||||||
|
version: HEAD
|
||||||
|
register: git_result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- git_result is changed
|
||||||
|
|
||||||
# Test a revision not available under refs/heads/ or refs/tags/
|
# Test a revision not available under refs/heads/ or refs/tags/
|
||||||
|
|
||||||
- name: SPECIFIC-REVISION | attempt to get unavailable revision
|
- name: SPECIFIC-REVISION | attempt to get unavailable revision
|
||||||
|
|
Loading…
Reference in a new issue