1
1
mirror of https://github.com/chubin/cheat.sh.git synced 2024-11-28 20:28:39 +03:00

Add -- to git commands to avoid ambiguities (fixes #303)

This commit is contained in:
Igor Chubin 2022-04-17 11:59:37 +00:00
parent 9ab558cc98
commit 4f047acc25
2 changed files with 5 additions and 5 deletions

View File

@ -124,7 +124,7 @@ class GitRepositoryAdapter(RepositoryAdapter): #pylint: disable=abstract-meth
raise RuntimeError( raise RuntimeError(
"Do not known how to handle this repository: %s" % cls._repository_url) "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 @classmethod
def save_state(cls, state): def save_state(cls, state):
@ -157,6 +157,6 @@ class GitRepositoryAdapter(RepositoryAdapter): #pylint: disable=abstract-meth
The list is used to invalidate the cache. The list is used to invalidate the cache.
""" """
current_state = cls.get_state() current_state = cls.get_state()
if current_state is None: if not current_state:
return ['git', 'ls-tree', '--full-tree', '-r', '--name-only', 'HEAD'] return ['git', 'ls-tree', '--full-tree', '-r', '--name-only', 'HEAD', "--"]
return ['git', 'diff', '--name-only', current_state, 'HEAD'] return ['git', 'diff', '--name-only', current_state, 'HEAD', "--"]

View File

@ -115,7 +115,7 @@ def _update_adapter(adptr):
errorcode, output = _run_cmd(cmd) errorcode, output = _run_cmd(cmd)
if errorcode: 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 return False
# Getting current repository state # Getting current repository state