git: fix archive when update is set to no (#31829)

pull/4420/head
Martin Krizek 2017-10-31 13:56:40 +01:00 committed by GitHub
parent 52aa522c19
commit e3a847a142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -118,6 +118,8 @@ options:
version_added: "1.2" version_added: "1.2"
description: description:
- If C(no), do not retrieve new revisions from the origin repository - If C(no), do not retrieve new revisions from the origin repository
- Operations like archive will work on the existing (old) repository and might
not respond to changes to the options version or remote.
executable: executable:
required: false required: false
default: null default: null
@ -1087,6 +1089,15 @@ def main():
# requested. # requested.
result['before'] = get_version(module, git_path, dest) result['before'] = get_version(module, git_path, dest)
result.update(after=result['before']) result.update(after=result['before'])
if archive:
# Git archive is not supported by all git servers, so
# we will first clone and perform git archive from local directory
if module.check_mode:
result.update(changed=True)
module.exit_json(**result)
create_archive(git_path, module, dest, archive, version, repo, result)
module.exit_json(**result) module.exit_json(**result)
else: else:
# else do a pull # else do a pull