* 🐛 Make integration tests compatible w/ modern Git This patch makes use of the `init.defaultBranch` setting to unify the test across new and old Git versions since one defaults to `master` and the other uses `main` for the default branch. Where possible, it uses the `HEAD` committish to avoid having to normalize the branch name. The change fixes the following integration tests: * `ansible-galaxy` * `ansible-galaxy-collection-scm` (recursive collection) * `git` * 🐛Replace `git-symbolic-ref` with a repo template This custom Git repository template emulates the `init.defaultBranch` setting on Git versions below 2.28. Ref: https://superuser.com/a/1559582. Other workarounds mentioned there, like invoking `git symbolic-ref HEAD refs/heads/main` after each `git init` turned out to have mysterious side effects that break the tests in surprising ways. * 🎨 Make Git integration test non-destructive This patch makes use of the `$HOME` environment variable to trick Git into using a user-global config generated in the temporary directory.
53 lines
2.0 KiB
YAML
53 lines
2.0 KiB
YAML
# test code for the git module
|
|
# (c) 2014, James Tanner <tanner.jc@gmail.com>
|
|
|
|
# This file is part of Ansible
|
|
#
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# NOTE: Moving `$HOME` to tmp dir allows this integration test be
|
|
# NOTE: non-destructive. There is no other way to instruct Git use a custom
|
|
# NOTE: config path. There are new `$GIT_CONFIG_KEY_{COUNT,KEY,VALUE}` vars
|
|
# NOTE: for setting specific configuration values but those are only available
|
|
# NOTE: since Git v2.31 which is why we cannot rely on them yet.
|
|
|
|
- block:
|
|
- import_tasks: setup.yml
|
|
- import_tasks: setup-local-repos.yml
|
|
|
|
- import_tasks: formats.yml
|
|
- import_tasks: missing_hostkey.yml
|
|
- import_tasks: missing_hostkey_acceptnew.yml
|
|
- import_tasks: no-destination.yml
|
|
- import_tasks: specific-revision.yml
|
|
- import_tasks: submodules.yml
|
|
- import_tasks: change-repo-url.yml
|
|
- import_tasks: depth.yml
|
|
- import_tasks: single-branch.yml
|
|
- import_tasks: checkout-new-tag.yml
|
|
- include_tasks: gpg-verification.yml
|
|
when:
|
|
- not gpg_version.stderr
|
|
- gpg_version.stdout
|
|
- not (ansible_os_family == 'RedHat' and ansible_distribution_major_version is version('7', '<'))
|
|
- import_tasks: localmods.yml
|
|
- import_tasks: reset-origin.yml
|
|
- import_tasks: ambiguous-ref.yml
|
|
- import_tasks: archive.yml
|
|
- import_tasks: separate-git-dir.yml
|
|
- import_tasks: forcefully-fetch-tag.yml
|
|
environment:
|
|
HOME: >-
|
|
{{ remote_tmp_dir }}
|