Skip to content

Commit d83672a

Browse files
committed
vcs: Improve git parameters handling
Make sure that all user provided input is handled as expected.
1 parent 9a5a097 commit d83672a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

weblate/vcs/git.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_remote_branch(cls, repo: str):
8585
if not repo:
8686
return super().get_remote_branch(repo)
8787
try:
88-
result = cls._popen(["ls-remote", "--symref", repo, "HEAD"])
88+
result = cls._popen(["ls-remote", "--symref", "--", repo, "HEAD"])
8989
except RepositoryException:
9090
report_error(cause="Listing remote branch")
9191
return super().get_remote_branch(repo)
@@ -149,7 +149,9 @@ def get_depth():
149149
@classmethod
150150
def _clone(cls, source: str, target: str, branch: str):
151151
"""Clone repository."""
152-
cls._popen(["clone"] + cls.get_depth() + ["--branch", branch, source, target])
152+
cls._popen(
153+
["clone"] + cls.get_depth() + ["--branch", branch, "--", source, target]
154+
)
153155

154156
def get_config(self, path):
155157
"""Read entry from configuration."""
@@ -572,7 +574,7 @@ def get_last_repo_revision(cls, url):
572574

573575
@classmethod
574576
def get_remote_args(cls, source, target):
575-
result = ["--prefix=origin/", source, target]
577+
result = ["--prefix=origin/", "--", source, target]
576578
if cls.is_stdlayout(source):
577579
result.insert(0, "--stdlayout")
578580
revision = cls.get_last_repo_revision(source + "/trunk/")

0 commit comments

Comments
 (0)