summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-07-29 14:32:11 +0100
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2020-08-19 14:45:04 +0000
commit968cd30898333e064aaa28aead8da119e6b00b33 (patch)
tree6eae28fffcaeca63d7fd847ddd89bee5f2876375
parent8d5131de0c9c5d562648808c3693ee7a3bd9c1fd (diff)
downloadbuildstream-bwh/fix-git-remote-name-check-1.tar.gz
git source plugin: Fix check for remote existencebwh/fix-git-remote-name-check-1
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),