1
0

git-2015.8.0.rst 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. .. _2015.8.0-git-:
  2. =========================================
  3. Git State and Execution Modules Rewritten
  4. =========================================
  5. The git state and execution modules have gone through an extensive overhaul.
  6. Changes in the :py:func:`git.latest <salt.states.git.latest>` State
  7. -------------------------------------------------------------------
  8. - The ``branch`` argument has been added, allowing for a custom branch name to
  9. be used in the local checkout maintained by the :py:func:`git.latest
  10. <salt.states.git.latest>` state. This can be helpful in avoiding ambiguous
  11. refs in the local checkout when a tag is used as the ``rev`` argument. If no
  12. ``branch`` is specified, then the state uses the value of ``rev`` as the
  13. branch name.
  14. - The ``always_fetch`` argument no longer has any effect, and will be removed
  15. in a future release. The state now detects whether or not a fetch is needed
  16. based on comparisons made between the local and remote repositories.
  17. - The ``force_fetch`` argument has been added to force a fetch if the fetch is
  18. not a fast-forward (for instance, if someone has done a reset and
  19. force-pushed to the remote repository).
  20. - The ``remote_name`` argument has been deprecated and renamed to ``remote``.
  21. - The ``force`` argument has been deprecated and renamed to ``force_clone`` to
  22. reduce ambiguity with the other "force" arguments.
  23. - Using SHA1 hashes (full or shortened) in the ``rev`` argument is now
  24. properly supported.
  25. - Non-fast-forward merges are now detected before the repository is updated,
  26. and the state will not update the repository if the change is not a
  27. fast-forward. Non-fast-forward updates must be overridden with the
  28. ``force_reset`` argument. If ``force_reset`` is set to ``True``, the state
  29. will only reset the repository if it cannot be fast-forwarded. This is in
  30. contrast to the earlier behavior, in which a hard-reset would be performed
  31. every time the state was run if ``force_reset`` was set to ``True``.
  32. - A ``git pull`` is no longer performed by this state, dropped in favor of a
  33. fetch-and-merge (or fetch-and-reset) workflow.
  34. :py:func:`git.config_unset <salt.states.git.config_unset>` state added
  35. ----------------------------------------------------------------------
  36. This state allows for configuration values (or entire keys) to be unset. See
  37. :py:func:`here <salt.states.git.config_unset>` for more information and example
  38. SLS.
  39. git.config State Renamed to :py:func:`git.config_set <salt.states.git.config_set>`
  40. ----------------------------------------------------------------------------------
  41. To reduce confusion after the addition of :py:func:`git.config_unset
  42. <salt.states.git.config_unset>`, the git.config state has been renamed to
  43. :py:func:`git.config_set <salt.states.git.config_set>`. The old config.get name
  44. will still work for a couple releases, allowing time for SLS files to be
  45. updated.
  46. In addition, this state now supports managing multivar git configuration
  47. values. See :py:func:`here <salt.states.git.config_set>` for more information
  48. and example SLS.
  49. Initial Support for Git Worktrees in Execution Module
  50. -----------------------------------------------------
  51. Several functions have been added to the execution module to manage worktrees_
  52. (a feature new to Git 2.5.0). State support does not exist yet, but will follow
  53. soon.
  54. .. _worktrees: http://git-scm.com/docs/git-worktree
  55. New Functions in Git Execution Module
  56. -------------------------------------
  57. - :py:func:`git.config_get_regexp <salt.modules.git.config_regexp>`
  58. - :py:func:`git.config_unset <salt.modules.git.config_unset>`
  59. - :py:func:`git.is_worktree <salt.modules.git.is_worktree>`
  60. - :py:func:`git.list_branches <salt.modules.git.list_branches>`
  61. - :py:func:`git.list_tags <salt.modules.git.list_tags>`
  62. - :py:func:`git.list_worktrees <salt.modules.git.list_worktrees>`
  63. - :py:func:`git.merge_base <salt.modules.git.merge_base>`
  64. - :py:func:`git.merge_tree <salt.modules.git.merge_tree>`
  65. - :py:func:`git.rev_parse <salt.modules.git.rev_parse>`
  66. - :py:func:`git.version <salt.modules.git.version>`
  67. - :py:func:`git.worktree_rm <salt.modules.git.worktree_rm>`
  68. - :py:func:`git.worktree_add <salt.modules.git.worktree_add>`
  69. - :py:func:`git.worktree_prune <salt.modules.git.worktree_prune>`
  70. Changes to Functions in Git Execution Module
  71. --------------------------------------------
  72. :py:func:`git.add <salt.states.git.add>`
  73. ****************************************
  74. - ``--verbose`` is now implied when running the ``git add`` command, to provide
  75. a list of the files added in the return data.
  76. :py:func:`git.archive <salt.modules.git.archive>`
  77. *************************************************
  78. - Now returns ``True`` when the ``git archive`` command was successful, and
  79. otherwise raises an error.
  80. - The ``overwrite`` argument has been added to prevent an existing archive from
  81. being overwritten by this function.
  82. - The ``fmt`` argument has been deprecated and renamed to ``format``.
  83. - Trailing slash no longer implied in ``prefix`` argument, must be included if
  84. this argument is passed.
  85. :py:func:`git.checkout <salt.modules.git.checkout>`
  86. ***************************************************
  87. - The ``rev`` argument is now optional when using ``-b`` or ``-B`` in ``opts``,
  88. allowing for a branch to be created (or reset) using ``HEAD`` as the starting
  89. point.
  90. :py:func:`git.clone <salt.modules.git.clone>`
  91. *********************************************
  92. - The ``name`` argument has been added to specify the name of the directory in
  93. which to clone the repository. If this option is specified, then the clone
  94. will be made within the directory specified by the ``cwd``, instead of at
  95. that location.
  96. - The ``repository`` argument has been deprecated and renamed to ``url``.
  97. :py:func:`git.config_get <salt.modules.git.config_get>`
  98. *******************************************************
  99. - The ``setting_name`` argument has been deprecated and renamed to ``key``.
  100. - The ``global`` argument has been added, to query the global git configuration
  101. - The ``all`` argument has been added to return a list of all values for the
  102. specified key, allowing for all values in a multivar to be returned.
  103. - The ``cwd`` argument is now optional if ``global`` is set to ``True``
  104. :py:func:`git.config_set <salt.modules.git.config_set>`
  105. *******************************************************
  106. - The value(s) of the key being set are now returned
  107. - The ``setting_name`` argument has been deprecated and renamed to ``key``.
  108. - The ``setting_value`` argument has been deprecated and renamed to ``value``.
  109. - The ``is_global`` argument has been deprecated and renamed to ``global``.
  110. - The ``multivar`` argument has been added to specify a list of values to set
  111. for the specified key. The ``value`` argument is not compatible with
  112. ``multivar``.
  113. - The ``add`` argument has been added to add a value to a key (this essentially
  114. just adds an ``--add`` to the ``git config`` command that is run to set the
  115. value).
  116. :py:func:`git.fetch <salt.modules.git.fetch>`
  117. *********************************************
  118. - The ``force`` argument has been added to force the fetch when it is not a
  119. fast-forward. This could have been achieved in previous Salt versions by
  120. including ``--force`` in the ``opts`` argument, this argument is just for
  121. convenience and to match the usage of other functions with ``force``
  122. arguments.
  123. - The ``refspecs`` argument has been added to allow for one or more refspecs to
  124. be provided which override the one(s) specified by the
  125. **remote.remote_name.fetch** git configuration option.
  126. :py:func:`git.ls_remote <salt.modules.git.ls_remote>`
  127. *****************************************************
  128. - The ``repository`` argument has been deprecated and renamed to ``remote``.
  129. - The ``branch`` argument has been deprecated and renamed to ``ref``.
  130. - The ``opts`` argument has been added to allow for additional CLI options to
  131. be passed to the ``git ls-remote`` command.
  132. :py:func:`git.merge <salt.modules.git.merge>`
  133. *********************************************
  134. - The ``branch`` argument has been deprecated and renamed to ``rev``.
  135. :py:func:`git.status <salt.modules.git.status>`
  136. ***********************************************
  137. - Return data has been changed from a list of lists to a dictionary containing
  138. lists of files in the modified, added, deleted, and untracked states.
  139. :py:func:`git.submodule <salt.modules.git.submodule>`
  140. *****************************************************
  141. - Added the ``command`` argument to allow for operations other than ``update``
  142. to be run on submodules, and deprecated the ``init`` argument. To do a
  143. submodule update with ``init=True`` moving forward, use ``command=update
  144. opts='--init'``.