user/dev discussion of public-inbox itself
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/3] solver: allow literal '\r' character in diff lines
Date: Sat, 4 Jan 2020 04:19:33 +0000
Message-ID: <20200104041933.GA23490@dcvr> (raw)
In-Reply-To: <20200104033415.17097-1-e@80x24.org>

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 | 2 +-
 xt/solver.t                  | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index eab8459b..5ac27988 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -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 = {
diff --git a/xt/solver.t b/xt/solver.t
index e9f24e7f..4ff57fe7 100644
--- a/xt/solver.t
+++ b/xt/solver.t
@@ -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',

      parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04  3:34 [PATCH 0/3] more solver fixes Eric Wong
2020-01-04  3:34 ` [PATCH 1/3] xt/solver.t: real-world regression tests Eric Wong
2020-01-04  3:34 ` [PATCH 2/3] solver: do not enforce order on extended headers Eric Wong
2020-01-04  3:34 ` [PATCH 3/3] solver: minor cleanups to diff extraction Eric Wong
2020-01-04  4:19 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200104041933.GA23490@dcvr \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git