The git state and execution modules have gone through an extensive overhaul.
git.latest
State¶branch
argument has been added, allowing for a custom branch name to
be used in the local checkout maintained by the git.latest
state. This can be helpful in avoiding ambiguous
refs in the local checkout when a tag is used as the rev
argument. If no
branch
is specified, then the state uses the value of rev
as the
branch name.always_fetch
argument no longer has any effect, and will be removed
in a future release. The state now detects whether or not a fetch is needed
based on comparisons made between the local and remote repositories.force_fetch
argument has been added to force a fetch if the fetch is
not a fast-forward (for instance, if someone has done a reset and
force-pushed to the remote repository).remote_name
argument has been deprecated and renamed to remote
.force
argument has been deprecated and renamed to force_clone
to
reduce ambiguity with the other "force" arguments.rev
argument is now
properly supported.force_reset
argument. If force_reset
is set to True
, the state
will only reset the repository if it cannot be fast-forwarded. This is in
contrast to the earlier behavior, in which a hard-reset would be performed
every time the state was run if force_reset
was set to True
.git pull
is no longer performed by this state, dropped in favor of a
fetch-and-merge (or fetch-and-reset) workflow.git.config_unset
state added¶This state allows for configuration values (or entire keys) to be unset. See
here
for more information and example
SLS.
git.config_set
¶To reduce confusion after the addition of git.config_unset
, the git.config state has been renamed to
git.config_set
. The old config.get name
will still work for a couple releases, allowing time for SLS files to be
updated.
In addition, this state now supports managing multivar git configuration
values. See here
for more information
and example SLS.
Several functions have been added to the execution module to manage worktrees (a feature new to Git 2.5.0). State support does not exist yet, but will follow soon.
git.add
¶--verbose
is now implied when running the git add
command, to provide
a list of the files added in the return data.git.archive
¶True
when the git archive
command was successful, and
otherwise raises an error.overwrite
argument has been added to prevent an existing archive from
being overwritten by this function.fmt
argument has been deprecated and renamed to format
.prefix
argument, must be included if
this argument is passed.git.checkout
¶rev
argument is now optional when using -b
or -B
in opts
,
allowing for a branch to be created (or reset) using HEAD
as the starting
point.git.clone
¶name
argument has been added to specify the name of the directory in
which to clone the repository. If this option is specified, then the clone
will be made within the directory specified by the cwd
, instead of at
that location.repository
argument has been deprecated and renamed to url
.git.config_get
¶setting_name
argument has been deprecated and renamed to key
.global
argument has been added, to query the global git configurationall
argument has been added to return a list of all values for the
specified key, allowing for all values in a multivar to be returned.cwd
argument is now optional if global
is set to True
git.config_set
¶setting_name
argument has been deprecated and renamed to key
.setting_value
argument has been deprecated and renamed to value
.is_global
argument has been deprecated and renamed to global
.multivar
argument has been added to specify a list of values to set
for the specified key. The value
argument is not compatible with
multivar
.add
argument has been added to add a value to a key (this essentially
just adds an --add
to the git config
command that is run to set the
value).git.fetch
¶force
argument has been added to force the fetch when it is not a
fast-forward. This could have been achieved in previous Salt versions by
including --force
in the opts
argument, this argument is just for
convenience and to match the usage of other functions with force
arguments.refspecs
argument has been added to allow for one or more refspecs to
be provided which override the one(s) specified by the
remote.remote_name.fetch git configuration option.git.ls_remote
¶repository
argument has been deprecated and renamed to remote
.branch
argument has been deprecated and renamed to ref
.opts
argument has been added to allow for additional CLI options to
be passed to the git ls-remote
command.git.status
¶git.submodule
¶command
argument to allow for operations other than update
to be run on submodules, and deprecated the init
argument. To do a
submodule update with init=True
moving forward, use command=update
opts='--init'
.