Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible-test - change diff matching regexp so prefixes are optional #74177

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/ansible-test-diff-prefix-optional.yml
Original file line number Diff line number Diff line change
@@ -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``
2 changes: 1 addition & 1 deletion test/lib/ansible_test/_internal/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def process_start(self):
"""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.')
Expand Down