unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] import: normalize body by stripping trailing newlines
@ 2016-05-12  9:52 Eric Wong
  2016-05-12  9:52 ` [PATCH] import: fallback to email if '<>' exists in author name Eric Wong
  2016-05-12  9:52 ` [PATCH] git-http-backend: do not drop connection on successful finish Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2016-05-12  9:52 UTC (permalink / raw)
  To: meta

Mbox formatters may add extra newlines at the end of the
message, and that's not relevant for comparing messages
for deletion.
---
 lib/PublicInbox/Import.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 5a3c585..1f52a0c 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -65,6 +65,13 @@ sub now2822 () {
 		$day, $t[3], $mon, $t[5] + 1900, $t[2], $t[1], $t[0]);
 }
 
+sub norm_body ($) {
+	my ($mime) = @_;
+	my $b = $mime->body_raw;
+	$b =~ s/(\r?\n)+\z//s;
+	$b
+}
+
 # returns undef on non-existent
 # ('MISMATCH', msg) on mismatch
 # (:MARK, msg) on success
@@ -106,7 +113,7 @@ sub remove {
 	die "bad read on final byte: <$lf>" if $lf ne "\n";
 	my $cur = Email::MIME->new($buf);
 	if ($cur->header('Subject') ne $mime->header('Subject') ||
-			$cur->body ne $mime->body) {
+			norm_body($cur) ne norm_body($mime)) {
 		return ('MISMATCH', $cur);
 	}
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] import: fallback to email if '<>' exists in author name
  2016-05-12  9:52 [PATCH] import: normalize body by stripping trailing newlines Eric Wong
@ 2016-05-12  9:52 ` Eric Wong
  2016-05-12  9:52 ` [PATCH] git-http-backend: do not drop connection on successful finish Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-05-12  9:52 UTC (permalink / raw)
  To: meta

git doesn't handle '<' and '>' characters in the author
name at all regardless of quoting, not just matched pairs.
So fall back to using the email as the author name since
the commit info isn't critical, anyways (shallow clones
are fine).
---
 lib/PublicInbox/Import.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 1f52a0c..1db2a0b 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -152,7 +152,7 @@ sub add {
 	#  "'A U Thor <u@example.com>' via foo" <foo@example.com>
 	# ref:
 	# <CAD0k6qSUYANxbjjbE4jTW4EeVwOYgBD=bXkSu=akiYC_CB7Ffw@mail.gmail.com>
-	$name =~ s/<([^>]+)>/($1)/g;
+	$name =~ tr/<>// and $name = $email;
 
 	my ($r, $w) = $self->gfi_start;
 	my $tip = $self->{tip};

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] git-http-backend: do not drop connection on successful finish
  2016-05-12  9:52 [PATCH] import: normalize body by stripping trailing newlines Eric Wong
  2016-05-12  9:52 ` [PATCH] import: fallback to email if '<>' exists in author name Eric Wong
@ 2016-05-12  9:52 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-05-12  9:52 UTC (permalink / raw)
  To: meta

We can maintain the client HTTP connection if the process exited
with failure as long as we terminated our own response properly.
---
 lib/PublicInbox/GitHTTPBackend.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 020b088..abb70df 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -259,10 +259,7 @@ sub serve_smart {
 		if (defined $pid) {
 			my $e = $pid == waitpid($pid, 0) ?
 				$? : "PID:$pid still running?";
-			if ($e) {
-				err($env, "git http-backend ($git_dir): $e");
-				drop_client($env);
-			}
+			err($env, "git http-backend ($git_dir): $e") if $e;
 		}
 		return unless $res;
 		my $dumb = serve_dumb($cgi, $git, $path);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-12  9:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12  9:52 [PATCH] import: normalize body by stripping trailing newlines Eric Wong
2016-05-12  9:52 ` [PATCH] import: fallback to email if '<>' exists in author name Eric Wong
2016-05-12  9:52 ` [PATCH] git-http-backend: do not drop connection on successful finish Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).