tools: Make git_log status not-applicable for files with no log.

This commit is contained in:
Andrew Hamilton 2021-05-06 05:07:11 +10:00
parent 50b95aa10f
commit 7ffcd6c46c
2 changed files with 14 additions and 9 deletions

View file

@ -457,6 +457,19 @@ def godoc(path):
return Status.normal, stdout
@deps(deps={"git"}, url="https://git-scm.com/docs/git-log",
executables={"git"})
def git_log(path):
status, output = _run_command(
["git", "log", "--find-renames", "--follow", "--stat", "--color",
path], success_status=Status.normal,
error_status=Status.not_applicable, has_color=True)
if output.data == "":
return Status.not_applicable, ""
else:
return status, output
def make_tool_function(dependencies, command, url=None, success_status=None,
error_status=None, has_color=False, timeout=None):
if url is None:
@ -473,7 +486,7 @@ def make_tool_function(dependencies, command, url=None, success_status=None,
return func
elinks, git_blame, git_log = None, None, None # For linters.
elinks, git_blame = None, None # For linters.
with importlib.resources.open_text(eris, "tools.toml") as tools_toml_file:
tools_toml = toml.load(tools_toml_file)
tools_for_extensions = tools_toml["tools_for_extensions"]

View file

@ -119,14 +119,6 @@ tools_for_extensions = [
error_status = "not_applicable"
has_color = true
[git_log]
dependencies = ["git"]
url = "https://git-scm.com/docs/git-log"
command = "git log --find-renames --follow --stat --color"
success_status = "normal"
error_status = "not_applicable"
has_color = true
[dis]
dependencies = []
url = "https://docs.python.org/3/library/dis.html"