From c54d7f3a53a908409e90ea64963fcdb628d196ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 3 Mar 2022 08:45:16 +0100 Subject: [PATCH] vcs: Improve git parameters handling Make sure that all user provided input is handled as expected. --- weblate/vcs/git.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/weblate/vcs/git.py b/weblate/vcs/git.py index ab620b878026..e1b9d6810722 100644 --- a/weblate/vcs/git.py +++ b/weblate/vcs/git.py @@ -85,7 +85,7 @@ def get_remote_branch(cls, repo: str): if not repo: return super().get_remote_branch(repo) try: - result = cls._popen(["ls-remote", "--symref", repo, "HEAD"]) + result = cls._popen(["ls-remote", "--symref", "--", repo, "HEAD"]) except RepositoryException: report_error(cause="Listing remote branch") return super().get_remote_branch(repo) @@ -149,7 +149,9 @@ def get_depth(): @classmethod def _clone(cls, source: str, target: str, branch: str): """Clone repository.""" - cls._popen(["clone"] + cls.get_depth() + ["--branch", branch, source, target]) + cls._popen( + ["clone"] + cls.get_depth() + ["--branch", branch, "--", source, target] + ) def get_config(self, path): """Read entry from configuration.""" @@ -572,7 +574,7 @@ def get_last_repo_revision(cls, url): @classmethod def get_remote_args(cls, source, target): - result = ["--prefix=origin/", source, target] + result = ["--prefix=origin/", "--", source, target] if cls.is_stdlayout(source): result.insert(0, "--stdlayout") revision = cls.get_last_repo_revision(source + "/trunk/")