From 4f047acc256c16cb4bfbd8f3aad201fc5d276b9b Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sun, 17 Apr 2022 11:59:37 +0000 Subject: [PATCH] Add -- to git commands to avoid ambiguities (fixes #303) --- lib/adapter/git_adapter.py | 8 ++++---- lib/fetch.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/adapter/git_adapter.py b/lib/adapter/git_adapter.py index 0ff52a0..8aa1864 100644 --- a/lib/adapter/git_adapter.py +++ b/lib/adapter/git_adapter.py @@ -124,7 +124,7 @@ class GitRepositoryAdapter(RepositoryAdapter): #pylint: disable=abstract-meth raise RuntimeError( "Do not known how to handle this repository: %s" % cls._repository_url) - return ['git', 'rev-parse', '--short', 'HEAD'] + return ['git', 'rev-parse', '--short', 'HEAD', "--"] @classmethod def save_state(cls, state): @@ -157,6 +157,6 @@ class GitRepositoryAdapter(RepositoryAdapter): #pylint: disable=abstract-meth The list is used to invalidate the cache. """ current_state = cls.get_state() - if current_state is None: - return ['git', 'ls-tree', '--full-tree', '-r', '--name-only', 'HEAD'] - return ['git', 'diff', '--name-only', current_state, 'HEAD'] + if not current_state: + return ['git', 'ls-tree', '--full-tree', '-r', '--name-only', 'HEAD', "--"] + return ['git', 'diff', '--name-only', current_state, 'HEAD', "--"] diff --git a/lib/fetch.py b/lib/fetch.py index df85aea..c33d87d 100644 --- a/lib/fetch.py +++ b/lib/fetch.py @@ -115,7 +115,7 @@ def _update_adapter(adptr): errorcode, output = _run_cmd(cmd) if errorcode: - _log("\nERROR:\n---\n" + output + "\n---\nCould not update %s" % adptr) + _log("\nERROR:\n---%s\n" % output.decode("utf-8") + "\n---\nCould not update %s" % adptr) return False # Getting current repository state