Commit Graph

229 Commits (07443a2bcd67e61cdc2ed43828c6ec50fd6ef91d)

Author SHA1 Message Date
jctanner c73f9d0492 git: add a umask parameter (#4473)
Sources #10504
Fixes #10279
2016-12-08 11:24:51 -05:00
jctanner 53a0a64bda git: set the file:// protocol if needed and refactor HEAD parser (#4434)
* make HEAD parsing more robust
* Fail the module for any splitter errors
* fix combining depth and version on filepath urls by prepending file://

Addresses #907
2016-12-08 11:24:50 -05:00
Timmo Verlaan 159918a8ef Determine branch name more reliable (#907)
* Made some changes to determine branch name more reliable (it may contain slashes now).

* Determination of branch name more reliable, as per comment on PR #907
2016-12-08 11:24:50 -05:00
jctanner 7e65315d92 git: Use a local copy of unfrackpath to avoid using ansible.lib (#4426)
Fixes #4425
2016-12-08 11:24:50 -05:00
jctanner c60954605b git: If force=yes, apply --force to submodule updates to overwrite local changes (#4415)
Fixes #238
2016-12-08 11:24:50 -05:00
Rob Cutmore 09b06a601c Git: Determine if remote URL is being changed (#4243)
* Git: Determine if remote URL is being changed

Ansible reported there were no changes when only the remote URL for a
repo was changed. This properly tracks and reports when the remote URL
for a repo changes.

Fixes #4006

* Fix handling of local repo paths

* Git: Use newer method for fetching remote URL

* Git: use ls-remote to fetch remote URL

Using ls-remote to fetch remote URL is supported in earlier versions
of Git compared to using remote command.

* Maintain previous behavior for older Git versions

Previously whether or not the remote URL changed was not factored
into command's changed status. Git versions prior to 1.7.5 lack the
functionality used for fetching a repo's remote URL so these versions
will update the remote URL without affecting the changed status.
2016-12-08 11:24:50 -05:00
jctanner 634b1024d6 git: save changed submodules in check and non-check mode (#4392) 2016-12-08 11:24:49 -05:00
Dag Wieers 4ee9cc4b3f Add diff mode support to git module (#3364)
* Add diffmode support to git module

This patch adds missing diffmode support to the git module.

* Remodel get_diff() and calls to it

As proposed by @abadger

* Ensure we fetch the required object before performing a diff

Also we handle the return code ourselves, so don't leave this up to run_command().
2016-12-08 11:24:49 -05:00
Zoltán Müllner ac561772ea Revert "Reset all locale environment variables before running svn commands" (#4358)
* Revert "Reset all locale environment variables before running svn commands"

This reverts commit 99456fbc9851209f4482cdf6c246806ba1e9fbff.

* Reset locale environment variables before running svn commands
2016-12-08 11:24:48 -05:00
Robin Roth 5d928ca13c Fix git shallow update (#3912)
* remove unused variables

* fetch branch name instead of HEAD

fix #3782, which was introduced by f1bacc1d3f9578f26d4ae2f66112cbb2509a7fe8

* disable git depth option for old git versions

fixes #3782
git support for `--depth` did not fully work in old git versions (before 1.8.2)
fall back to full clones/fetches on those versions

* raise required git version to 1.9.1 for depth option

* use correct depth argument in switch_version
2016-12-08 11:24:41 -05:00
Toshio Kuratomi eadef56a06 Add comment 2016-12-08 11:24:38 -05:00
Marius Gedminas 3a8a11d85f git: fix change testing when version is HEAD (#3025)
When `version` is not specified, it defaults to "HEAD".  "HEAD" is not a
remote tag, and it's not listed in the output of get_branches(), so we'd
keep repo_updated at the default value (None) and then return early with
changed=True in --check mode, even when before == after.

Fixes #3024.
2016-12-08 11:24:38 -05:00
Toshio Kuratomi b259c65b20 Revert "Fix git shallow update (#3794)" -- Broke integration tests: https://app.shippable.com/runs/57599a7897ae890c00c2898d
This reverts commit c26eb1217fae8703a7b9cd8ae708051c58fc9273.
2016-12-08 11:24:36 -05:00
Robin Roth 513c3bf287 Fix git shallow update (#3794)
* remove unused variables

* fetch branch name instead of HEAD

fix #3782, which was introduced by f1bacc1d3f9578f26d4ae2f66112cbb2509a7fe8

* disable git depth option for old git versions

fixes #3782
git support for `--depth` did not fully work in old git versions (before 1.8.2)
fall back to full clones/fetches on those versions
2016-12-08 11:24:36 -05:00
Michael Scherer 82df6f981e Improve error reporting when git binary fail (#3266)
Showing stderr or stdout is a great help to understand
when something go south.
2016-12-08 11:24:30 -05:00
Michael Scherer b788f45b49 Use the proper type for 'dest' argument 2016-12-08 11:24:28 -05:00
Michael Scherer 54c71b9331 Add a better solution for the ssh_known_hosts issue
Fix https://github.com/ansible/ansible/issues/10172 too
2016-12-08 11:24:25 -05:00
Robin Roth 281398fdc2 fix git switch branches in combination with depth on old git versions (#3492)
* fix git switch branches in combination with depth

* the old implementation is correct, but relies on git working correctly
  (as only newer versions do)
* with some older git version (e.g. 1.8.3), git fetch remote branch does
  not work, if the branch does not yet exist locally
* this patch works around that without explicitly checking the git version
* future refactoring is needed to reduce the number of fetches to a
  minimum; but this patch makes the code "correct"

* add git version requirements to doc

* replace set-branches with git 1.7.1 compatible version
2016-12-08 11:24:20 -05:00
Rene Moser 885b8dc4d0 git: fix status to use porcelain, ignore user configuration
From the git status doc:

    --porcelain

        Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git versions and regardless of user configuration. See below for details.

User configuration can break the git module from working as expected.
2016-12-08 11:24:20 -05:00
Robin Roth c7cb1b28cd fall back to full clone if version is hash
if version is not a branch or tag (i.e. a hash), we need a full checkout to be able to switch to it
2016-12-08 11:24:19 -05:00
Robin Roth 8e5e5108d1 with depth only fetch actual version
* don't use refs/heads/branchname for branches
* for tags it's needed thou
* fixes #3456
2016-12-08 11:24:19 -05:00
Kyle Dyroff 58f30646ed Log git error stdout/stderr to fail_json (#3022) 2016-12-08 11:24:18 -05:00
Robin Roth b9e55a0877 make git updates respect depth (#3254)
* make git updates respect depth

until now `fetch` gets all tags and heads at full depth, this change
* uses `depth` argument for `fetch`
* only get the specified `version` in `fetch`

* fixes #14954

* treat combination of refspec and depth correctly

* be more conservative for non-depth fetch
2016-12-08 11:24:18 -05:00
Petrox c050776f9e Missing documentation fix (#2516)
Extending the documentation to state, that this module does not handle externals well.
2016-12-08 11:24:17 -05:00
Toshio Kuratomi 40948cfcc4 git still needs to have abspath applied to dest 2016-12-08 11:24:16 -05:00
Thomas Quinot a5ec00f89f Reset all locale environment variables before running svn commands
We screenscrape the output of svn(1), so better ensure it is using the

C locale.

Fixes #3255
2016-12-08 11:24:16 -05:00
Michael Scherer 3d415ac2da Use type='path' for path arguments for git module 2016-12-08 11:24:14 -05:00
Toshio Kuratomi 8b711c1c77 change a parameter to type=path 2016-12-08 11:24:08 -05:00
Toshio Kuratomi f8f84f0491 Since we screenscrape output from git to tell us information we need to use the C locale when running commands.
Using another locale would mean that we get information that may have
the strings that we are looking for.

Fixes #2449
Fixes #2462
2016-12-08 11:24:03 -05:00
Jordan Bach b6213ffa80 git: set remote branch before switching versions when using depth argument 2016-12-08 11:23:59 -05:00
Jordi Gutiérrez Hermoso 4682ea1c3c hg: discard changes without changing the current revision
The command `hg up -C` by default moves to the latest revision on the
current branch. The `discard` function was trying to update to a
different branch, in case it was provided, by passing a `-r REVISION`
argument. Not only is this not the intended effect of the `discard`
function, but this also could update to a different branch that hasn't
been pulled yet, which is how we were experiencing trouble.

Instead, we unconditionally do `hg up -C -r .` to "update" to the
current revision (i.e. to "."), while `-C/--clean`ing the current
directory. This is similar to `hg revert --all`, except that it also
undoes the merge state of the working directory, in case there was
any.
2016-12-08 11:23:57 -05:00
Jan Duzinkiewicz 9c6db69827 forcing git fetch if sha1 are equal between repos but branch exists only at remote
Add an explanatory comment to the code
2016-12-08 11:23:57 -05:00
Dmitry Labutin 60b1273d55 Github uses both HTTP and HTTPS protocols 2016-12-08 11:23:56 -05:00
Chris Streeter 04b52efb64 Fix name of ssh_opts arg 2016-12-08 11:23:48 -05:00
Tim Barnes d98683e1c5 fixing issue with subversion module whereby the module was reporting local modifications being present when externals were being used 2016-12-08 11:23:41 -05:00
Andrew Widdersheim 7d174daa77 Fix detached head detection in is_not_a_branch()
Detached head detection seems to have broken somewhere a long the way
because git decided to change how that situation looks when doing a 'git
branch -a' which is performed by get_branches().

This is how git 1.7.1 displays this situation (which works):

shell> git branch -a
* (no branch)
  master

This is the output from git 1.8.3.1 (which does not work):

shell> git branch -a
* (detached from e132711)
  master

It looks like this same wording is used in the most recent version of
git (2.6.1 as of writing this).
2016-12-08 11:23:39 -05:00
Benjamin Baumer d38cd4896d version_added for switch Parameter changed to 2.0 Add comment to explain check_rc Parameter in _exec Function Optimize code and clean up is_svn_repo Function 2016-12-08 11:23:29 -05:00
Benjamin Baumer 04add7409e Fix: Calling svn info to determine if dest is an svn Working Copy, to support updates in Subfolders with Subversion > 1.8 Fix: Ignoring svn:externals on local Modification Check. Add: Added Argument switch to alow skipping the svn switch call. 2016-12-08 11:23:29 -05:00
Jan Inowolski 3d45384aed update git remote url before ls-remote
related to #8177
2016-12-08 11:23:28 -05:00
Chris AtLee e7af5d2384 Add support for 'update' parameter to hg module 2016-12-08 11:23:24 -05:00
Matt Martz 30d5c1166c Replaced tabbed indentation with spaces for subversion module 2016-12-08 11:23:16 -05:00
Brian Coca b261fd8d3e added doc to note that git the command line tool is required for this moduel to function fixes http://github.com/ansible/ansible/issues/11358 2016-12-08 11:23:14 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
Brian Coca 3d42d8897e fixed doc issue with git 2016-12-08 11:23:06 -05:00
Dionysis Grigoropoulos 59f7db899d git: Add option to verify GPG signature of commit 2016-12-08 11:23:05 -05:00
Gugli a00c078912 Add support for repos with svn:externals files
When a SVN repository has some svn:externals properties, files will be
reported with the X attribute, and lines will be added at the end to
list externals statuses with a text looking like
"Performing status on external item at ....".
Such lines were counted as a local modification by the regex, and the
module returned a change, even though they were none.

To have a clean (and parsable) "svn status" output, it is recommended
to use the --quiet option. The externals will only appear if they have
been modified. With this option on, it seems even safer to consider
there are local modifications when "svn status" outputs anything.
2016-12-08 11:23:04 -05:00
Toshio Kuratomi 52d769d36c Reverse the force parameter for the hg module 2016-12-08 11:22:40 -05:00
Toshio Kuratomi 49f5b28fbd Change the git force parameter to default to no as a safety change.
Fixes #306
2016-12-08 11:22:40 -05:00
Toshio Kuratomi 245dce0e30 Make documentation list when force changed defaults 2016-12-08 11:22:40 -05:00
Toshio Kuratomi 36a483dacd Update force documentation to reflect default=no 2016-12-08 11:22:40 -05:00
Michael Scherer d357f309b5 Fix #370, by allowing to export over a existing repository
This requires to use force=True
2016-12-08 11:22:36 -05:00
Michael Scherer e1194116b2 Make force parameter work for export operation
The default is changed from 'yes' to 'no' to follow
subversion behavior (ie, requiring explicit confirmation
to erase a existing repository). Since that was not working before
cf #370 and since the option was ignored before and unused, this
should be safe to change.
2016-12-08 11:22:36 -05:00
Nate Coraor 771fdfb1f8 Fix a few bugs and misbehavior in the hg module: 1. Don't pull when `dest` is already at the desired changeset. 2. Don't change the working copy when cleaning or pulling and a revision was specified. 3. Change the default for the `revision` param to match the behavior of hg. 2016-12-08 11:22:36 -05:00
Toshio Kuratomi 1be539d870 git fetch --tags overwrites normal fetching with git < 1.8.x so do a normal fetch followed by using the refspec format for fetching tags 2016-12-08 11:22:34 -05:00
Toshio Kuratomi 73b7d6ea7b Fix typo in git refspec code. Change lists to tuples 2016-12-08 11:22:34 -05:00
Toshio Kuratomi 5c090207ff Make documentation clear about update=no vs clone=no 2016-12-08 11:22:34 -05:00
Rohan McGovern b607ffb7c6 git: add 'refspec' argument
This argument may be used to fetch additional refs beyond the default
refs/heads/* and refs/tags/*.  Checking out GitHub pull requests or Gerrit
patch sets are two examples where this is useful.

Without this, specifying version=<sha1> with a SHA1 unreachable from any
tag or branch can't work.
2016-12-08 11:22:34 -05:00
Rohan McGovern 06ff34f364 git: clean up "fetch" method
De-duplicate repetitive code checking the exit code.

Include the stdout/stderr of the failed process in all cases.

Remove the returned values because no caller uses them.

Combine git commands where possible.  There is no need to fetch branches
and tags as two separate operations.
2016-12-08 11:22:34 -05:00
Toshio Kuratomi 8af70de1fc Probably would make clone a 1.9 feature rather than 1.8.3 2016-12-08 11:22:33 -05:00
Toshio Kuratomi a7ff6c4cba Make git's update parameter revert to its old behaviour and add new clone parameter to take its place.
Fixes #426
Fixes https://github.com/ansible/ansible/issues/8630
2016-12-08 11:22:33 -05:00
Toshio Kuratomi 123c99f879 Add error message from git to message returned from ansible
Fixes #81
2016-12-08 11:22:33 -05:00
Toshio Kuratomi 88ccfc219a Change git update param documentation to match reality 2016-12-08 11:22:32 -05:00
Toshio Kuratomi 8b586ad055 Before pulling submodules from repos add ssh hostkeys for those submodules
Fixes #9655
2016-12-08 11:22:32 -05:00
Toshio Kuratomi 6f3f0904eb Fix git mod so that we switch to the desired version even if it was previously downloaded 2016-12-08 11:22:32 -05:00
Toshio Kuratomi 59066f6138 Some cleanups to the git module 2016-12-08 11:22:32 -05:00
Toshio Kuratomi fc15177e6e Revert git module doc update because it appears ssh:// works and bare ssh repo does not
This reverts commit e715909831e27cbfed2ae86e886bf154cefd7b6c.
2016-12-08 11:22:31 -05:00
Lorin Hochstein 0cf3cfbf5a git doc: don't prepend ssh:// for ssh repo
The github ssh example has ssh:// at the beginning of the url. However, this doesn't
work. It does work if the ssh:// is removed.
2016-12-08 11:22:31 -05:00
Jérémie Astori c52bfe3e35 Fix #91: Expand user home folder for the key_file path of the git module 2016-12-08 11:22:30 -05:00
Antti Salminen 75e15e2ae9 Find the actual commit annotated tags refer to instead of the tag object. 2016-12-08 11:22:29 -05:00
Toshio Kuratomi b00e6464e9 Fix cornercase tracebaxk when detecting whether submodules changed 2016-12-08 11:22:28 -05:00
Toshio Kuratomi 3e09de7aef Fix git module checking out correct version after initial clone
Fixes #313
2016-12-08 11:22:27 -05:00
Toshio Kuratomi dfd4433fba Fix git module handling of the recursive flag
Fixes: #169
2016-12-08 11:22:24 -05:00
Toshio Kuratomi 5fc463eee7 Update desctiprion, parameter name, and default value as discussed in #55 2016-12-08 11:22:24 -05:00
CptLausebaer a572f85d43 correct requirement of parameter dest
The parameter "dest:" is required, but it is documented as "required: false".
2016-12-08 11:22:24 -05:00
Chad Nelson 20706f5f4d Chnge option name to track_submodule_branches.
Update documentation to reflect what the actual effect of the option.
2016-12-08 11:22:23 -05:00
Chad Nelson 5f30157a05 Give option on how git tracks submodules.
Allows user to decide if git submodule should track branches/tags or track commit hashes defined in the superproject.

Add track_branches parameter to the git module.

Defaults to track branches behavior.
2016-12-08 11:22:23 -05:00
Michael DeHaan ef2a2b9093 package files 2016-12-08 11:22:22 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00
Michael DeHaan c7eec45b73 Restructuring. 2016-12-08 11:22:22 -05:00