mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use supplied remote name when cloning git repository
This commit is contained in:
parent
328951ef53
commit
49d41da152
1 changed files with 3 additions and 3 deletions
|
@ -77,13 +77,13 @@ def get_version(dest):
|
||||||
sha = sha[0].split()[1]
|
sha = sha[0].split()[1]
|
||||||
return sha
|
return sha
|
||||||
|
|
||||||
def clone(repo, dest):
|
def clone(repo, dest, remote):
|
||||||
''' makes a new git repo if it does not already exist '''
|
''' makes a new git repo if it does not already exist '''
|
||||||
try:
|
try:
|
||||||
os.makedirs(os.path.dirname(dest))
|
os.makedirs(os.path.dirname(dest))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return _run("git clone %s %s" % (repo, dest))
|
return _run("git clone -o %s %s %s" % (remote, repo, dest))
|
||||||
|
|
||||||
def has_local_mods(dest):
|
def has_local_mods(dest):
|
||||||
os.chdir(dest)
|
os.chdir(dest)
|
||||||
|
@ -217,7 +217,7 @@ def main():
|
||||||
before = None
|
before = None
|
||||||
local_mods = False
|
local_mods = False
|
||||||
if not os.path.exists(gitconfig):
|
if not os.path.exists(gitconfig):
|
||||||
(rc, out, err) = clone(repo, dest)
|
(rc, out, err) = clone(repo, dest, remote)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(msg=err)
|
module.fail_json(msg=err)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue