Commit graph

183 commits

Author SHA1 Message Date
jctanner
45c1ae0ac1 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-08-15 19:54:44 -04:00
Timmo Verlaan
2942b383c4 [git] 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-08-15 14:54:11 -04:00
jctanner
a0f4c9ee45 git: Use a local copy of unfrackpath to avoid using ansible.lib (#4426)
Fixes #4425
2016-08-15 12:22:55 -04:00
jctanner
0445697a8b git: If force=yes, apply --force to submodule updates to overwrite local changes (#4415)
Fixes #238
2016-08-12 18:06:02 -04:00
Rob Cutmore
0acbbdf0c4 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-08-12 09:53:06 -04:00
jctanner
37ea0b0b1f git: save changed submodules in check and non-check mode (#4392) 2016-08-11 14:14:20 -04:00
Dag Wieers
f5f1ec65e4 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-08-11 13:27:32 -04:00
Zoltán Müllner
8218e7ba25 Revert "Reset all locale environment variables before running svn commands" (#4358)
* Revert "Reset all locale environment variables before running svn commands"

This reverts commit 99456fbc98.

* Reset locale environment variables before running svn commands
2016-08-08 10:18:50 -04:00
Robin Roth
f6fae82ec2 Fix git shallow update (#3912)
* remove unused variables

* fetch branch name instead of HEAD

fix #3782, which was introduced by f1bacc1d3f

* 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-07-05 14:57:38 -04:00
Toshio Kuratomi
2ecf9987bf Add comment 2016-06-21 09:25:55 -07:00
Marius Gedminas
0cd9497748 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-06-21 09:22:53 -07:00
Toshio Kuratomi
138430f116 Revert "Fix git shallow update (#3794)" -- Broke integration tests:
https://app.shippable.com/runs/57599a7897ae890c00c2898d

This reverts commit c26eb1217f.
2016-06-09 14:48:51 -07:00
Robin Roth
c26eb1217f Fix git shallow update (#3794)
* remove unused variables

* fetch branch name instead of HEAD

fix #3782, which was introduced by f1bacc1d3f

* 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-06-09 08:51:02 -07:00
Michael Scherer
a64d72d7bc Improve error reporting when git binary fail (#3266)
Showing stderr or stdout is a great help to understand
when something go south.
2016-05-20 09:45:53 -07:00
Michael Scherer
514da9550b Use the proper type for 'dest' argument 2016-05-14 12:08:39 +02:00
Michael Scherer
94ec38cda8 Add a better solution for the ssh_known_hosts issue
Fix https://github.com/ansible/ansible/issues/10172 too
2016-04-28 20:27:18 +02:00
Toshio Kuratomi
3cbca32e73 Merge pull request #3507 from resmo/fix/git-porcelain-status
git: fix status to use porcelain, ignore user configuration
2016-04-21 08:51:37 -07:00
Robin Roth
2256ae0793 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-04-21 07:40:54 -07:00
Rene Moser
1f92e77650 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-04-21 10:41:03 +02:00
Toshio Kuratomi
98322a777f Merge pull request #3466 from robinro/git-full-clone-with-hash
git: fall back to full clone if version is hash
2016-04-19 07:42:06 -07:00
Robin Roth
b67d15f385 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-04-19 13:45:43 +02:00
Robin Roth
c398eb5399 with depth only fetch actual version
* don't use refs/heads/branchname for branches
* for tags it's needed thou
* fixes #3456
2016-04-19 12:47:36 +02:00
Kyle Dyroff
2b003a2773 Log git error stdout/stderr to fail_json (#3022) 2016-04-19 08:56:48 +02:00
Robin Roth
f1bacc1d3f 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-04-14 09:40:23 -07:00
Petrox
99cd31140d Missing documentation fix (#2516)
Extending the documentation to state, that this module does not handle externals well.
2016-04-12 22:12:30 +02:00
Toshio Kuratomi
ee90762388 git still needs to have abspath applied to dest 2016-04-06 14:03:17 -07:00
Thomas Quinot
99456fbc98 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-04-05 10:23:33 -07:00
Michael Scherer
870311748f Use type='path' for path arguments for git module 2016-03-29 08:50:09 +02:00
Brian Coca
7461feb737 Merge pull request #934 from jbgo/git-depth-switch-version
git: set remote branch before switching versions when using depth arg
2016-03-11 10:37:12 -05:00
Toshio Kuratomi
0019a89d14 change a parameter to type=path 2016-02-29 00:26:56 -08:00
Toshio Kuratomi
2e46c086ae 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-02-07 12:48:41 -08:00
Brian Coca
2a33599698 Merge pull request #2528 from jordiecometrica/hg-discard
hg: discard changes without changing the current revision
2016-01-12 09:34:29 -05:00
Jan Duzinkiewicz
b77bf7a9aa forcing git fetch if sha1 are equal between repos but branch exists only at remote
Add an explanatory comment to the code
2016-01-11 17:09:51 -08:00
Dmitry Labutin
0f21a9316d Github uses both HTTP and HTTPS protocols 2015-12-29 09:58:38 +03:00
Jordi Gutiérrez Hermoso
c038e7013a 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.
2015-11-23 14:35:06 -05:00
Chris Streeter
13343a8888 Fix name of ssh_opts arg 2015-11-19 14:00:35 -08:00
Brian Coca
4908d4a019 Merge pull request #2235 from tdbabas/devel
Fixing issue with subversion module whereby the module was reporting local modifications being present when externals were being used
2015-10-15 10:25:54 -04:00
Tim Barnes
f0ac28490d fixing issue with subversion module whereby the module was reporting local modifications being present when externals were being used 2015-10-09 15:15:53 +01:00
Andrew Widdersheim
e36e1339e8 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).
2015-10-06 15:37:45 -04:00
James Cammarata
4de4bd0be6 Merge pull request #465 from bbaumer/devel
SVN 1.7 Support, ignore svn:externals on local mod check and new switch toggle
2015-09-11 13:10:33 -04:00
Brian Coca
57c0b86db4 Merge pull request #721 from jinowolski/devel
update git remote url before ls-remote
2015-09-04 12:46:51 -04:00
Brian Coca
42ccb25182 Merge pull request #1149 from catlee/hg_update
Add support for 'update' parameter to hg module
2015-07-21 20:17:28 -04:00
Benjamin Baumer
8255657ac9 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
2015-07-07 13:38:19 +02:00
Benjamin Baumer
20f76d76a8 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.
2015-07-07 12:08:04 +02:00
Matt Martz
4f43c4c09c Replaced tabbed indentation with spaces for subversion module 2015-07-01 09:39:19 -05:00
Brian Coca
2d3e93e558 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
2015-06-27 00:36:55 -04:00
Greg DeKoenigsberg
2a5f0bde87 Proper author info for all remaining modules 2015-06-15 15:53:30 -04:00
Brian Coca
74e40b5fe1 fixed doc issue with git 2015-06-10 12:42:15 -04:00
Brian Coca
118b00968c Merge pull request #783 from Gugli/fix-svn-has-local-mods-with-externals
Fix subversion module for repos with svn:externals files
2015-06-10 11:12:03 -04:00
Dionysis Grigoropoulos
a9e68692b7
git: Add option to verify GPG signature of commit 2015-06-09 01:51:40 +03:00