LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 24637 - clang-tidy-diff.py is not working for git diff with multiple files
Summary: clang-tidy-diff.py is not working for git diff with multiple files
Status: RESOLVED FIXED
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: PC Linux
: P release blocker
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-31 08:52 PDT by Bartek Wolowiec
Modified: 2015-09-01 14:15 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bartek Wolowiec 2015-08-31 08:52:55 PDT
recent changes in clang-tidy-diff.py breaks compatibilty with git diff

Here is a breaking commit (wrong regexp, incorrectly treats '\n' as not whitespace) 
https://github.com/llvm-mirror/clang-tools-extra/commit/0ca9a2b8cacc3facad1787c4c445e50ebd9c3b7d
Comment 1 Yaron Keren 2015-09-01 14:15:08 PDT
The regex in r245683 is
 match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p, line)
while the regex in your e-mail was
 match = re.search('^+++\ \"?(.?/){%s}([^ \t\"\n])' % args.p, line)
 
there are three changes between the regexs.

1) The additional \n I understand.
2) , + are not escaped which I do not understand why as + is a special character in Python regex (see https://docs.python.org/2/library/re.html).
2) The star after [^ \t\"\n] went missing. 

I've committed 1), additional \n on r246575. I hope this is enough to fix the issue but without an example cannot test this. 
If more changes are needed please reopen the bug with a short example diff that breaks the regex so I can test everything before committing.