Skip to content
Snippets Groups Projects
Unverified Commit 4cee4a5f authored by Ian Stapleton Cordasco's avatar Ian Stapleton Cordasco Committed by GitHub
Browse files

Merge pull request #706 from mic4ael/mnemonic-symbols-git

Fix handling of diffs with mnemonic prefixes
parents 4f5d398f 766c78a0
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -191,3 +191,13 @@ class ShellTestCase(unittest.TestCase):
self.assertFalse(errcode)
self.assertFalse(stdout)
self.assertFalse(stderr)
for index, diff_line in enumerate(diff_lines, 0):
diff_line = diff_line.replace('a/', 'i/')
diff_lines[index] = diff_line.replace('b/', 'w/')
self.stdin = '\n'.join(diff_lines)
stdout, stderr, errcode = self.pycodestyle('--diff')
self.assertFalse(errcode)
self.assertFalse(stdout)
self.assertFalse(stderr)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment