aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cgit
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-03-15 20:30:36 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2022-03-15 20:30:36 +0300
commita508139e3fa259392e26f804c54bd71ba109c819 (patch)
treed691b334a8dd79d3d9a4bdd2fda5ff8c1115b922 /cgit
parentDockerfile: set maintainer label (diff)
downloadcgitize-a508139e3fa259392e26f804c54bd71ba109c819.tar.gz
cgitize-a508139e3fa259392e26f804c54bd71ba109c819.zip
get rid of annoying "false" messages in output
Diffstat (limited to '')
-rw-r--r--cgitize/cgit.py3
-rw-r--r--cgitize/git.py2
-rw-r--r--cgitize/utils.py4
3 files changed, 5 insertions, 4 deletions
diff --git a/cgitize/cgit.py b/cgitize/cgit.py
index 769690b..dd06216 100644
--- a/cgitize/cgit.py
+++ b/cgitize/cgit.py
@@ -115,7 +115,8 @@ class CGitRepositories:
return self._mirror(repo)
with chdir(repo_dir):
- if not Git.check('rev-parse', '--is-inside-work-tree'):
+ success, output = Git.capture('rev-parse', '--is-inside-work-tree')
+ if not success:
# Overwrite the existing directory if it's not a Git repository.
logging.warning('Local directory is not a repository, going to overwrite it: %s', repo_dir)
return self._mirror(repo)
diff --git a/cgitize/git.py b/cgitize/git.py
index 14ccce7..35b2e1e 100644
--- a/cgitize/git.py
+++ b/cgitize/git.py
@@ -145,7 +145,7 @@ class Git:
@staticmethod
def capture(*args, **kwargs):
- return utils.try_run_capture(Git.EXE, *args, env=GIT_ENV, **kwargs)
+ return utils.try_capture(Git.EXE, *args, env=GIT_ENV, **kwargs)
@staticmethod
def get_global_config():
diff --git a/cgitize/utils.py b/cgitize/utils.py
index 64b419a..78834c9 100644
--- a/cgitize/utils.py
+++ b/cgitize/utils.py
@@ -53,11 +53,11 @@ def try_run(*args, **kwargs):
return e.returncode == 0
-def run_capture(*args, **kwargs):
+def capture(*args, **kwargs):
return run(*args, capture_output=True, **kwargs)
-def try_run_capture(*args, **kwargs):
+def try_capture(*args, **kwargs):
try:
return True, run(*args, capture_output=True, **kwargs)
except subprocess.CalledProcessError as e: