From e834b23060043152def40bb8a3a83f86c32dde77 Mon Sep 17 00:00:00 2001 From: Constantine Peresypkin Date: Thu, 10 Apr 2014 14:13:23 +0300 Subject: [PATCH] fix issue #6932 add `git remote set-url` before fetch to set the remote repo to the new url, if provided --- library/source_control/git | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/source_control/git b/library/source_control/git index 968b763b1a..84dc9fdbef 100644 --- a/library/source_control/git +++ b/library/source_control/git @@ -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): ''' 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: (rc, out1, err1) = module.run_command([git_path, 'fetch', remote, '+refs/heads/*:refs/heads/*'], cwd=dest) else: