summaryrefslogtreecommitdiff
path: root/pycodestyle.py
diff options
context:
space:
mode:
authorMichal Kolodziejski <crossner90@gmail.com>2017-12-06 21:34:46 +0100
committerMichal Kolodziejski <crossner90@gmail.com>2017-12-27 10:56:10 +0100
commit766c78a01d9ef8908f8254d9e8a19cac28c8d048 (patch)
tree450756bc1e00a1319d95c05609194110350b31e1 /pycodestyle.py
parent4f5d398f9256727ad8fd7f67c45ea60a8fad5a4a (diff)
downloadpep8-766c78a01d9ef8908f8254d9e8a19cac28c8d048.tar.gz
Fix handling of diffs with mnemonic prefixes
Diffstat (limited to 'pycodestyle.py')
-rwxr-xr-xpycodestyle.py4
1 files changed, 3 insertions, 1 deletions
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)