]> Sergey Matveev's repositories - public-inbox.git/commitdiff
solver: allow literal '\r' character in diff lines
authorEric Wong <e@80x24.org>
Sat, 4 Jan 2020 04:19:33 +0000 (04:19 +0000)
committerEric Wong <e@80x24.org>
Sat, 4 Jan 2020 04:19:42 +0000 (04:19 +0000)
While filenames are escaped, the actual diff contents may
contain an unescaped "\r" carriage return byte not in front
of the "\n" line feed.  So just allow "\r" to appear in the
middle of a line.

lib/PublicInbox/SolverGit.pm
xt/solver.t

index eab8459bc341935545b2e28b4e92ce0a22958b93..5ac27988591c961a9335735727d8b3cf80f825a4 100644 (file)
@@ -155,7 +155,7 @@ sub extract_diff ($$) {
                # the meat of the diff, including "^\\No newline ..."
                # We also allow for totally blank lines w/o leading spaces,
                # because git-apply(1) handles that case, too
-               (?:^(?:[\@\+\x20\-\\][^\r\n]*|)$LF)+
+               (?:^(?:[\@\+\x20\-\\][^\n]*|)$LF)+
        )!smx or return;
 
        my $di = {
index e9f24e7f78ae6dbb0fd6b3ff2168564252f72f9e..4ff57fe75d4de1fe60443f64add4e03e7f5075a4 100644 (file)
@@ -20,6 +20,8 @@ my $app = sub {
 # TODO: convert these to self-contained test cases
 my $todo = {
        'git' => [
+               '9e9048b02bd04d287461543d85db0bb715b89f8c'
+                       .'/s/?b=t%2Ft3420%2Fremove-ids.sed',
                'eebf7a8/s/?b=t%2Ftest-lib.sh',
                'eb580ca513/s/?b=remote-odb.c',
                '776fa90f7f/s/?b=contrib/git-jump/git-jump',