summaryrefslogtreecommitdiff
path: root/morphlib/gitdir.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2015-05-06 14:15:15 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2015-05-06 14:15:15 +0000
commit11391bcb949b19bc542f9a46b4392db01b3c7b93 (patch)
treec109121af3caf6da755e005590823ce579300ce7 /morphlib/gitdir.py
parent534fe7aaca2d0e6048e92c6c76e455c5c972ad85 (diff)
downloadmorph-11391bcb949b19bc542f9a46b4392db01b3c7b93.tar.gz
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
Diffstat (limited to 'morphlib/gitdir.py')
-rw-r--r--morphlib/gitdir.py4
1 files changed, 2 insertions, 2 deletions
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):