summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-07-29 14:32:11 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-07-29 14:35:32 +0100
commit396657cb77af947cc82ba792deec7df6b77cf68b (patch)
tree1e89f852a15548a2fc3665832c1c4f4536463cda
parent89765b759230c8d47e27fd52527cf3df61be9ae1 (diff)
downloadbuildstream-bwh/fix-git-remote-name-check-1.4.tar.gz
git source plugin: Fix check for remote existencebwh/fix-git-remote-name-check-1.4
When checking whether a remote exists in the cached git repository, we currently perform a substring match on the output of 'git remote'. This fails when there is an existing remote name that contains the name we're looking for. This was fixed by the rewrite of git fetching in !1808, but that change seems unsuitable for the stable 1.4 branch. Instead, split the command output into a list and check that the remote name is in the list. Closes #1372.
-rw-r--r--buildstream/plugins/sources/git.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index 495246423..94472bacd 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -185,7 +185,7 @@ class GitMirror(SourceFetcher):
fail="Failed to retrieve list of remotes in {}".format(self.mirror),
cwd=self.mirror
)
- if remote_name not in remotes:
+ if remote_name not in remotes.strip().split():
self.source.call(
[self.source.host_git, 'remote', 'add', remote_name, url],
fail="Failed to add remote {} with url {}".format(remote_name, url),