From 766c78a01d9ef8908f8254d9e8a19cac28c8d048 Mon Sep 17 00:00:00 2001 From: Michal Kolodziejski Date: Wed, 6 Dec 2017 21:34:46 +0100 Subject: Fix handling of diffs with mnemonic prefixes --- pycodestyle.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pycodestyle.py') diff --git a/pycodestyle.py b/pycodestyle.py index 1b06691..eb9ff63 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -1538,7 +1538,9 @@ def parse_udiff(diff, patterns=None, parent='.'): rv[path].update(range(row, row + nrows)) elif line[:3] == '+++': path = line[4:].split('\t', 1)[0] - if path[:2] == 'b/': + # Git diff will use (i)ndex, (w)ork tree, (c)ommit and (o)bject + # instead of a/b/c/d as prefixes for patches + if path[:2] in ('b/', 'w/', 'i/'): path = path[2:] rv[path] = set() return dict([(os.path.join(parent, path), rows) -- cgit v1.2.1