From 6e0365e8baa436243042f769e6181b9e437e8af4 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Wed, 3 Feb 2016 11:47:00 +0100 Subject: [PATCH] Fix inconsistent behavior with -f "**" (#95). Improved by taking advantage of the detected file types during the first pass in the changes module. --- gitinspector/blame.py | 8 +++++--- gitinspector/extensions.py | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gitinspector/blame.py b/gitinspector/blame.py index 8580fe9..130c4be 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -26,7 +26,7 @@ import subprocess import threading from .localization import N_ from .changes import FileDiff -from . import comment, filtering, format, interval, terminal +from . import comment, extensions, filtering, format, interval, terminal NUM_THREADS = multiprocessing.cpu_count() @@ -137,11 +137,13 @@ class Blame(object): row = row.encode("latin-1", "replace") row = row.decode("utf-8", "replace").strip("\"").strip("'").strip() - if FileDiff.is_valid_extension(row) and not filtering.set_filtered(FileDiff.get_filename(row)): + if FileDiff.get_extension(row) in extensions.get_located() and not \ + filtering.set_filtered(FileDiff.get_filename(row)): blame_command = filter(None, ["git", "blame", "--line-porcelain", "-w"] + \ (["-C", "-C", "-M"] if hard else []) + [interval.get_since(), interval.get_ref(), "--", row]) - thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row), self.blames, row.strip()) + thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row), + self.blames, row.strip()) thread.daemon = True thread.start() diff --git a/gitinspector/extensions.py b/gitinspector/extensions.py index f565494..3764735 100644 --- a/gitinspector/extensions.py +++ b/gitinspector/extensions.py @@ -36,3 +36,6 @@ def add_located(string): __located_extensions__.add("*") else: __located_extensions__.add(string) + +def get_located(): + return __located_extensions__