Skip to content

Commit

Permalink
vcs: Improve git parameters handling
Browse files Browse the repository at this point in the history
Make sure that all user provided input is handled as expected.
  • Loading branch information
nijel committed Mar 3, 2022
1 parent 9a5a097 commit d83672a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions weblate/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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/")
Expand Down

0 comments on commit d83672a

Please # to comment.