user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH] PublicInbox::Import::add: Consolidate subject handling
  2019-05-17  1:53  7% [PATCH] PublicInbox::Import::add: Consolidate subject handling Eric W. Biederman
@ 2019-05-18  8:04  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-05-18  8:04 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: meta

Thanks, pushed to master as 8c925f2e250853b62fdb2a4ebdd45c2bba71544e

^ permalink raw reply	[relevance 7%]

* [PATCH] PublicInbox::Import::add: Consolidate subject handling
@ 2019-05-17  1:53  7% Eric W. Biederman
  2019-05-18  8:04  7% ` Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric W. Biederman @ 2019-05-17  1:53 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta


Consolidate subject handling in the add function to make it easier to
read and understand.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
 lib/PublicInbox/Import.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 12abf39995ff..81a38fb6987d 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -367,10 +367,14 @@ sub add {
 	my @ct = msg_timestamp($hdr);
 	my $author_time_raw = git_timestamp(@at);
 	my $commit_time_raw = git_timestamp(@ct);
+
 	my $subject = $mime->header('Subject');
 	$subject = '(no subject)' unless defined $subject;
-	my $path_type = $self->{path_type};
+	# Mime decoding can create nulls replace them with spaces to protect git
+	$subject =~ tr/\0/ /;
+	utf8::encode($subject);
 
+	my $path_type = $self->{path_type};
 	my $path;
 	if ($path_type eq '2/38') {
 		$path = mid2path(v1_mid0($mime));
@@ -411,9 +415,6 @@ sub add {
 		print $w "reset $ref\n" or wfail;
 	}
 
-	# Mime decoding can create nulls replace them with spaces to protect git
-	$subject =~ tr/\0/ /;
-	utf8::encode($subject);
 	print $w "commit $ref\nmark :$commit\n",
 		"author $name <$email> $author_time_raw\n",
 		"committer $self->{ident} $commit_time_raw\n" or wfail;
-- 
2.17.1


^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-05-17  1:53  7% [PATCH] PublicInbox::Import::add: Consolidate subject handling Eric W. Biederman
2019-05-18  8:04  7% ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).