diff --git a/changelogs/fragments/ansible-test-diff-prefix-optional.yml b/changelogs/fragments/ansible-test-diff-prefix-optional.yml new file mode 100644 index 00000000000..2394965328d --- /dev/null +++ b/changelogs/fragments/ansible-test-diff-prefix-optional.yml @@ -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`` diff --git a/test/lib/ansible_test/_internal/diff.py b/test/lib/ansible_test/_internal/diff.py index 1e2038b98be..5671ec7f280 100644 --- a/test/lib/ansible_test/_internal/diff.py +++ b/test/lib/ansible_test/_internal/diff.py @@ -180,7 +180,7 @@ class DiffParser: """Process a diff start line.""" self.complete_file() - match = re.search(r'^diff --git "?a/(?P.*)"? "?b/(?P.*)"?$', self.line) + match = re.search(r'^diff --git "?(?:a/)?(?P.*)"? "?(?:b/)?(?P.*)"?$', self.line) if not match: raise Exception('Unexpected diff start line.')