You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:30:57 UTC
[buildstream] 02/03: git source plugin: Fix check for remote
existence
This is an automated email from the ASF dual-hosted git repository.
root pushed a commit to branch bst-1.4
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit f5784d0b123ea3dabde07c68e0e37f6be0b69c41
Author: Ben Hutchings <be...@codethink.co.uk>
AuthorDate: Wed Jul 29 14:32:11 2020 +0100
git source plugin: Fix check for remote existence
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.
---
buildstream/plugins/sources/git.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index 4952464..94472ba 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),