* git.latest: fail gracefully for misconfigured remote repo
When the remote repo's HEAD refers to a nonexistent ref, this was
causing a traceback when we tried to check if the upstream tracking
branch needed to be changed after cloning the repo. This commit fixes
this traceback by gracefully failing the state when the remote HEAD is
not present in the ``git ls-remote`` output, but the desired remote
revision doesn't exist.
Additionally, a similar graceful failure now happens if the state is run
again after we gracefully fail the first time, and we need to set the
tracking branch. Trying to set the tracking branch when there is no
local branch would fail with an ambiguous error like "fatal: branch
'master' does not exist", so before we even attempt to set the tracking
branch, the state is failed with a more descriptive comment.
* Add integration test for #36242
See https://github.com/saltstack/salt/issues/34790#issuecomment-238857462
This should help people understand the new behavior of the branch
parameter, when they run into non-fast-forward failures in git.latest
states when the remote rev differs from the name of the local branch.
Implementation of https://github.com/saltstack/salt/issues/34725 caused
these cases to be seen as non-fast-forward changes, requiring
force_reset=True to proceed. This resolves that unintended behavior.
Fixes#36321.
* Fixing integration tests if azure is not present
* Fixing integration tests failures if 'git' command is missing
Skip git state integration tests if 'git' does not exists
Prevent OSError if 'git' command not found during _git_version()
This adds a check for existence of the public and private keys, and
will raise an exception if they do not exist.
The git_pillar preflight checks have also been altered to try to init
the git_pillar repos, instead of just instantiating a GitPillar object.
This will cause invalid git_pillar configuration to keep the master from
starting up like we already do for gitfs.