fix issue #6932
add `git remote set-url` before fetch to set the remote repo to the new url, if provided
This commit is contained in:
parent
5ce6c86595
commit
e834b23060
1 changed files with 3 additions and 0 deletions
|
@ -393,6 +393,9 @@ def get_head_branch(git_path, module, dest, remote, bare=False):
|
||||||
|
|
||||||
def fetch(git_path, module, repo, dest, version, remote, bare):
|
def fetch(git_path, module, repo, dest, version, remote, bare):
|
||||||
''' updates repo from remote sources '''
|
''' updates repo from remote sources '''
|
||||||
|
(rc, out0, err0) = module.run_command([git_path, 'remote', 'set-url', remote, repo], cwd=dest)
|
||||||
|
if rc != 0:
|
||||||
|
module.fail_json(msg="Failed to set a new url %s for %s: %s" % (repo, remote, out0 + err0))
|
||||||
if bare:
|
if bare:
|
||||||
(rc, out1, err1) = module.run_command([git_path, 'fetch', remote, '+refs/heads/*:refs/heads/*'], cwd=dest)
|
(rc, out1, err1) = module.run_command([git_path, 'fetch', remote, '+refs/heads/*:refs/heads/*'], cwd=dest)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue