ansible-test - change diff mathching regexp so prefixes are optional

The `a/` and `b/` prefixes can be disabled in the `git diff` output by setting
`diff.noprefix` to `true`. The output is still a valid diff, but `ansible-test` would
raise an exception since without the prefixes, it thought the diff line was invalid.
pull/74192/head
Sam Doran 4 years ago committed by Matt Clay
parent 7b79b69369
commit 4df9ea86c2

@ -0,0 +1,4 @@
bugfixes:
- >-
ansible-test - make the ``a/`` and ``b/`` prefixes an optional match
since these can be turned off with the ``diff.noprefix`` setting in ``git``

@ -180,7 +180,7 @@ class DiffParser:
"""Process a diff start line."""
self.complete_file()
match = re.search(r'^diff --git "?a/(?P<old_path>.*)"? "?b/(?P<new_path>.*)"?$', self.line)
match = re.search(r'^diff --git "?(?:a/)?(?P<old_path>.*)"? "?(?:b/)?(?P<new_path>.*)"?$', self.line)
if not match:
raise Exception('Unexpected diff start line.')

Loading…
Cancel
Save