<div dir="rtl"><div dir="ltr">Hi,<br><br>In the other thread (search for ... 0ca9a2b from bartek-w) he provided a regex with two more changes beyond adding \n.</div><div dir="ltr">Here are all three regexes:<br></div><div dir="ltr"><br>pre-r245683<br> match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)<br>r245683<br> match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p, line)<br>bartek-w<br> match = re.search('^+++\ \"?(.?/){%s}([^ \t\"\n])' % args.p, line)<br> <br>in bartek-w version, + are not escaped which I do not understand why as + is a special character in Python regex (see <a href="https://docs.python.org/2/library/re.html">https://docs.python.org/2/library/re.html</a>) and  and the star after [^ \t\"\n] is missing. </div><div dir="ltr">Not wishing to break any working code I asked for the broken diff example to test against before comitting and so far didn't get a reply. </div><div dir="ltr"><br></div><div dir="ltr">Anyhow, adding the \n is safe and I've commited it now on r246575 but I'm still not clear about the other two regex changes. </div><div dir="ltr">I'll update the bug report accordingly.</div><div dir="ltr"><br></div><div dir="ltr">Yaron</div><div dir="ltr"><br></div><div dir="ltr"><br><br>2015-09-01 18:52 GMT+03:00 Alexander Kornienko <<a href="mailto:alexfh@google.com">alexfh@google.com</a>>:<br>><br>> Looks like this patch broke handling of multiple files: <a href="https://llvm.org/PR24637">https://llvm.org/PR24637</a><br>><br>> Can you take a look at this?<br>><br>> On Fri, Aug 21, 2015 at 12:56 PM, Yaron Keren <<a href="mailto:yaron.keren@gmail.com">yaron.keren@gmail.com</a>> wrote:<br>>><br>>> Whenever is any special character in the filename, such as space or backslash (Windows), some examples:<br>>><br>>> On Windows:<br>>> --- ".\\a.cpp"  2015-08-21 00:22:57.885370200 +0300<br>>> +++ b.cpp       2015-08-21 01:05:28.726269900 +0300<br>>><br>>> --- ./a.cpp     2015-08-21 00:22:57.885370200 +0300<br>>> +++ b.cpp       2015-08-21 01:05:28.726269900 +0300<br>>><br>>> --- "a a.cpp"   2015-08-21 00:22:57.885370200 +0300<br>>> +++ b.cpp       2015-08-21 01:05:28.726269900 +0300<br>>><br>>> On Linux:<br>>> ~$ diff -U0 ./a.cpp b\ b.cpp<br>>> --- ./a.cpp     2015-08-14 00:27:03.569276652 +0300<br>>> +++ "b b.cpp"   2015-08-21 13:54:26.787896719 +0300<br>>><br>>> filename with space will break current clang-tidy-diff.py on all platforms, the regular expression does not match quotes.<br>>> There is surely some Python package to process filenames correctly if this ever become a problem.<br>>><br>>><br>>> 2015-08-21 13:37 GMT+03:00 Alexander Kornienko <<a href="mailto:alexfh@google.com">alexfh@google.com</a>>:<br>>>><br>>>> On Fri, Aug 21, 2015 at 11:27 AM, Yaron Keren via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>>>>><br>>>>> Author: yrnkrn<br>>>>> Date: Fri Aug 21 04:27:24 2015<br>>>>> New Revision: 245683<br>>>>><br>>>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=245683&view=rev">http://llvm.org/viewvc/llvm-project?rev=245683&view=rev</a><br>>>>> Log:<br>>>>> Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput<br>>>><br>>>><br>>>> Out of curiosity, when does this happen? (I mean quotes around the file name)<br>>>>  <br>>>>><br>>>>>  <br>>>>><br>>>>><br>>>>> Modified:<br>>>>>     clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py<br>>>>><br>>>>> Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py<br>>>>> URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=245683&r1=245682&r2=245683&view=diff">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=245683&r1=245682&r2=245683&view=diff</a><br>>>>> ==============================================================================<br>>>>> --- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)<br>>>>> +++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Fri Aug 21 04:27:24 2015<br>>>>> @@ -67,7 +67,7 @@ def main():<br>>>>>    filename = None<br>>>>>    lines_by_file = {}<br>>>>>    for line in sys.stdin:<br>>>>> -    match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)<br>>>>> +    match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p, line)<br>>>>>      if match:<br>>>>>        filename = match.group(2)<br>>>>>      if filename == None:<br>>>>><br>>>>><br>>>>> _______________________________________________<br>>>>> cfe-commits mailing list<br>>>>> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>>>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>>>><br>>>><br>><br></div></div>