From c96d3c3ffe89f87c7ea2416847168a9a730b5ec6 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Tue, 13 Aug 2013 15:26:42 +0200 Subject: [PATCH] The blame module was not behaving quite right when used with "--since". It was not taking the caret (^) character into consideration when --since was being specified, something which resulted in an excess of attributed rows. With this easy fix, the behavior should now be "correct". --- gitinspector/blame.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitinspector/blame.py b/gitinspector/blame.py index 11538a1..380f48c 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -62,7 +62,7 @@ class BlameThread(threading.Thread): for j in git_blame_r.readlines(): j = j.decode("utf-8", "replace") - if Blame.is_blame_line(j): + if Blame.is_blame_line(j) and not (Blame.is_prior(j) and interval.get_since()): email = Blame.get_author_email(j) author = self.changes.get_latest_author_by_email(email) content = Blame.get_content(j) @@ -120,6 +120,10 @@ class Blame: def is_blame_line(string): return string.find(" (") != -1 + @staticmethod + def is_prior(string): + return string[0] == "^" + @staticmethod def get_author_email(string): author_email = re.search(" \((.*?)\d\d\d\d-\d\d-\d\d", string)