Apply the same logic as the pre-commit hook of exporting in a temporary
directory the local branches, tags or commits being pushed. This allows
to run the ansible-lint checks on any branch without touching the state
of the working directory.
Loop over all the given references. Fail at the first error found.
Handle the case of remote branch deletion by not running ansible-lint.
Export all the files of the reference given by using git archive.
Other alternatives could have been: git clone, but is quite verbose
when not a proper branch, and the repository and origin configuration is
not needed ; git worktree, but requires a special case for the
currently checkout branch, and one wouldn't want to have dangling
worktrees if something goes very wrong.
Apply the same logic as the pre-commit hook of exporting in a temporary directory the local branches, tags or commits being pushed. This allows to run the ansible-lint checks on any branch without touching the state of the working directory.
Loop over all the given references. Fail at the first error found.
Handle the case of remote branch deletion by not running ansible-lint.
Export all the files of the reference given by using
git archive
. Other alternatives could have been:git clone
, but is quite verbose when not a proper branch, and the repository and origin configuration is not needed ;git worktree
, but requires a special case for the currently checkout branch, and one wouldn't want to have dangling worktrees if something goes very wrong.Use
set -o pipefail
, so require Bash.