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.
This commit is contained in:
parent
7b79b69369
commit
4df9ea86c2
2 changed files with 5 additions and 1 deletions
|
@ -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."""
|
"""Process a diff start line."""
|
||||||
self.complete_file()
|
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:
|
if not match:
|
||||||
raise Exception('Unexpected diff start line.')
|
raise Exception('Unexpected diff start line.')
|
||||||
|
|
Loading…
Reference in a new issue