From 11391bcb949b19bc542f9a46b4392db01b3c7b93 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 6 May 2015 14:15:15 +0000 Subject: GitDir: Fix setting fetch url when push url is already on-disk 290483010cfc7945cd4483fadd1d98c3b83efb3 broke morph checkout, which uses set_fetch_url on a repository that has been cloned, hence has its origin remote url config already on-disk. The fix prevents it changing the push_url when the fetch_url is set, unless it is an unnamed remote, as if the config is on-disk, this already does the right thing. Change-Id: I6204f664407bab3d7f8ecf0fcca72f5015dee55e --- morphlib/gitdir.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'morphlib/gitdir.py') diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py index 021f35ea..b80096c3 100644 --- a/morphlib/gitdir.py +++ b/morphlib/gitdir.py @@ -249,7 +249,7 @@ class Remote(object): if self.name is not None: morphlib.git.gitcmd(self.gd._runcmd, 'remote', 'set-url', self.name, url) - if self.push_url is None: + if self.name is None and self.push_url is None: self.set_push_url(url) def set_push_url(self, url): @@ -257,7 +257,7 @@ class Remote(object): if self.name is not None: morphlib.git.gitcmd(self.gd._runcmd, 'remote', 'set-url', '--push', self.name, url) - if self.fetch_url is None: + if self.name is None and self.fetch_url is None: self.set_fetch_url(url) def _get_remote_url(self, remote_name, kind): -- cgit v1.2.1