Commit graph

54 commits

Author SHA1 Message Date
James Cammarata
9acf2454d4 Merge branch 'git_fix' of https://github.com/pkit/ansible into pkit-git_fix 2014-06-20 12:47:21 -05:00
Aleksey Khudyakov
ac6792356c Fix typo requird -> required 2014-05-24 00:10:46 +11:00
James Cammarata
31250905e9 Check module_path permissions when creating ssh_wrapper for git
If the module directory is not writable/executable to the current user
(most likely because of a sudo to a non-root user), the ssh_wrapper
will be created in the default location for mkstemp() calls. To facilitate
the deletion of these new files, a new mechanism for cleaning up files
created by the module was also added.

Fixes #7375
2014-05-14 21:22:22 -05:00
Chad Nelson
6aac9538a8 Only update submodules when recursive is true 2014-04-17 09:34:36 -04:00
Constantine Peresypkin
1c6c7716fd fix issue #6932
add `git remote set-url` before fetch to set the remote repo to the new url, if provided
2014-04-10 14:13:23 +03:00
James Tanner
b65857b4de Addresses #6750 Use --help instead of - 2014-04-03 15:26:48 -04:00
James Tanner
a2307bf2fc Fixes #6750 Check git subcommand for --remote and expose errors 2014-04-03 15:21:54 -04:00
Oleg A. Mamontov
045eba960e Fixed cwd for submodules update 2014-04-02 13:21:26 +04:00
Michael DeHaan
12391a4ba9 Merge branch 'intellectronica/non-recursive-git' of git://github.com/intellectronica/ansible into devel
Conflicts:
	library/source_control/git
2014-03-28 17:49:02 -04:00
addshore
68f12aa995 Add --remote to git submodule_update
This simply adds --remote to the git submodule update command.
This means that if a branch is defined in .gitmodules then we should track said branch when updating.
2014-03-28 13:01:39 -04:00
James Tanner
69d40b861f Fixes #6582 Re-add regex to ignore untracked files that were never tracked 2014-03-19 15:42:40 -04:00
James Tanner
6c8980c1a4 Fixes #6567 put the git wrapper script in the module temp dir 2014-03-19 10:30:10 -04:00
andreaskern
2385b28de5 add param to note example for ssh-keyscan
hostnames in the known hosts file are typically stored as Hashed values, calling 'ssh-keyscan' with '-H' changes to output to the Hashed format so that the known_hosts file looks more consistent
2014-03-18 17:24:56 +01:00
patrickheeney
4bc663092f Fix documentation for accept_hostkey 2014-03-13 07:58:12 -07:00
Patrick Smith
0f9cb7a24f git: Execute git commands in dest directory 2014-03-12 13:28:39 -04:00
James Tanner
fc33860e5d Force command action to not be executed by the shell unless specifically enabled 2014-03-10 16:13:30 -05:00
Jesse Keating
c6f4d4328b Make sure requested version tag gets downloaded
There is a subtle bug in how the git module currently works. If the
version you request is a tag name, and you've already got the repo
cloned, and the tag name is a new tag, but refers to the already checked
out working copy, the git module would exit early without change. This
is bad as it means the new tag ref was not fetched and could not be used
in later tasks.

This change will check if the version is a remote tag, and if the tag
doesn't exist locally. If that is true, it'll do a fetch.

The activity could still be seen as not a change, because the working
copy won't be updated, if the new tag refers to the already checked out
copy, but that's not different than before and can be fixed as a more
comprehensive overhaul of tracking change in the git module.
2014-02-07 14:13:04 -08:00
Michael Porter
6f685e45dc (#5822) Use mkstemp to open a temporary file (as NamedTemporaryFile doesn't take a delete argument in Python < 2.6) 2014-01-30 19:39:39 -05:00
James Tanner
dc51bb5389 Fixes #5750 Fail on missing ~/.ssh and ignore accept_hostkey if stricthoskeychecking is off 2014-01-28 11:49:35 -05:00
James Tanner
859128da0a Fix git module parameters to conform to code standards 2014-01-23 16:44:17 -05:00
James Tanner
07f9733e96 Fixes #4108 Add sshopts and keyfile parameters to the git module 2014-01-23 16:22:43 -05:00
James Tanner
13ce8728de Set accept_hostkey to False by default in the git module and fail
early if the key is unknown
2014-01-11 11:02:01 -05:00
James Tanner
24eba74edd Add an "accept_hostkey" parameter to the git module to help automatically
accept hostkeys for git repos and prevent task hangs when the key is unknown
2014-01-11 10:36:45 -05:00
James Tanner
38edad70ac Fixes #5023 Convert all modules to use new snippet import pattern 2013-12-02 15:11:23 -05:00
Tom Berger
840859202d Add a recursive option to the git command.
Make it possible to clone without submodules by setting
recursive to no. Default is yes, so no change is needed
in existing plays.
2013-12-02 09:41:07 -05:00
James Tanner
b97976d720 Addresses #5036 fix typo in git module 2013-11-25 09:55:05 -05:00
James Tanner
1ead99204d Fixes 5036 add missing parameter to git module function call 2013-11-25 09:51:07 -05:00
jctanner
a4bd206f09 Merge pull request #4691 from cg-soft/git-bare-ref-repo-support
Add support for bare git reference repos
2013-11-14 10:39:57 -08:00
Michael DeHaan
8687525d18 Fix documentation formatting. 2013-10-31 20:00:11 -04:00
Michael DeHaan
50ef750a25 Suggest keyscan for github/other SCM hanging. 2013-10-31 18:00:24 -04:00
Christian Goetze
c25d7e4165 Add support for bare git reference repos
This adds two parameters to the git module:

  bare (boolean)
    Indicates this is to be a bare repositori

  reference (string)
    Indicates the path or url to the reference repo.
    Check out the "--reference" option in the "git clone"
    man page

Added appropriate tests.
2013-10-31 10:56:14 -07:00
Yap Sok Ann
e568c63108 git: Don't add --branch while cloning if the version is a SHA-1 hash. 2013-10-16 20:37:07 +08:00
Yap Sok Ann
d77276380f git: Handle network problem when running git ls-remote. 2013-10-16 20:37:07 +08:00
Yap Sok Ann
633438bfbb git: Always return the before/after revisions, even in check mode.
The return values from check mode and non-check mode should match in all cases,
except when a SHA-1 hash is used as version, as there is no way to check if it
is a valid hash using `git ls-remote`.

Also, to accomodate this change, the force flag for the reset function has been
removed so that we can do the checking in main.
2013-10-16 20:37:07 +08:00
Yap Sok Ann
12c4bf51b8 git: Make function get_remote_head usable when cloning.
This allows the module to return the before/after revisions in all cases.
2013-10-16 20:37:07 +08:00
Yap Sok Ann
3ff0c6d50d git: Remove unnecessary return code checking.
The functions either return rc=0 or call fail_json themselves.
2013-10-16 20:37:06 +08:00
Yap Sok Ann
201ff02d1f git: Full length SHA-1 in, full length SHA-1 out.
This removes ambiguity at the expense of slight backward incompatibility.
2013-10-16 20:37:06 +08:00
James Tanner
1a9a6da4f7 fix docstring indentation on scc modules 2013-10-01 16:46:17 -04:00
Skylar Saveland
198c4702bd executable option to git module 2013-09-26 14:15:28 -07:00
James Cammarata
102833cca6 Merge branch 'gitfix' of https://github.com/johanwiren/ansible into johanwiren-gitfix 2013-08-22 15:30:58 -05:00
Johan Wirén
3ac5f2d409 Fixed so that we no longer check with the remote if a checkout already is at the desired sha version. 2013-08-22 22:05:37 +02:00
Drew Blas
d912de2dff Added git disclaimer about dealing with ssh host checking
This disclaimer already exists in library/source_control/hg but not here.  It affects both and was discussed awhile back on: https://groups.google.com/forum/#!msg/ansible-project/q9G9xIdsRxo/XJhQzuS-qSoJ  However no PR was ever sent to fix the doc.
2013-08-07 15:33:29 -05:00
Petr Svoboda
cbbd9c257d Tidy up fix of git module traceback 2013-08-02 12:54:06 +02:00
Petr Svoboda
85396cbd26 Fix traceback in git module when version checkout fails
"UnboundLocalError: local variable 'branch' referenced before assignment" is
raised in git, line 282, in switch_version.

Exception is raised when version is not branch and version checkout fails.
E.g. when version is nonexistant commit.
2013-08-01 12:10:43 +02:00
Michael DeHaan
10ac8ba3de Don't add --version HEAD parameter is already HEAD, some versions of git don't like this. 2013-07-20 11:24:16 -04:00
James Laska
cf563c6838 Resolve incompatability between depth and version
Git is unable to checkout the specified `version` when the repository is
cloned with a reduced history (`depth`).  However, if the repository is
already cloned, subsequent git module calls will update the repository
(default update=True), then properly checkout the specified `version`.
To allow the initial call to properly clone the specified `version`, at
the specified `depth`, this patch adds the `--branch` parameter when
cloning the repository.
2013-07-18 17:03:17 -04:00
Matt Spaulding
3e631c1129 Fix git submodule update when version specified 2013-07-03 17:19:14 -07:00
Stephen Fromm
ddee9187f0 Add submodule support to git module
This does two things:
* add --recursive option to git clone command in clone().  This will
  initialize all submodules when cloning a remote repository.
* Add submodule_update() and call that from fetch().  submodule_update()
  calls two git commands iff the file .gitmodules exists in the
  repository:
  * 'git submodule sync' - synchronizes the submodules' remote URL
    configuration setting to the value in .gitmodules.
  * 'git submodule update --init --recursive' - initialize and update
    registered submodules to the commit specified in the index of the
    containing repository.

If a repository was cloned without --recursive, submodule_update() will
ensure that the submodules are initialized and updated.
2013-06-20 14:48:39 -07:00
Jan-Piet Mens
3404a0fc16 DOCS: standardize on EXAMPLES (a.k.a. Docs-JumboPatch JetLag Edition)
Migrated all examples: in DOCUMENTATION=''' string to standalone EXAMPLES=''' string
  Added deprecation warning to moduledev.rst and remove deprecated example from it
  Fixed up a few typos and uppercased some acronyms.
  add consistency to how EXAMPLES are formatted
2013-06-15 20:54:25 +02:00
Benjamin Schwarze
3f95f15bb4 remove unused git function is_current_branch (looks like it returns always True anyway which might be wrong) 2013-05-31 22:27:56 +02:00