From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 10D8D1FA7B; Thu, 28 Aug 2014 05:01:02 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Eric Wong Subject: [PATCH] view: trim git patches delimited by /^---$/ Date: Thu, 28 Aug 2014 05:01:00 +0000 Message-Id: <1409202060-25693-1-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.1.0.2.g6fb949a.dirty List-Id: Patches are usually better viewed standalone and are difficult to judge when nested. So save precious vertical space in our message index. --- lib/PublicInbox/View.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 2794339..23cb369 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -81,6 +81,7 @@ sub index_entry { my ($part) = @_; return if $part->subparts; # walk_parts already recurses my $enc = enc_for($part->content_type) || $enc_msg || $enc_utf8; + my $more = ''; if ($part_nr > 0) { my $fn = $part->filename; @@ -96,13 +97,19 @@ sub index_entry { # Drop signatures $s =~ s/\n*-- \n.*\z//s; + # drop the remainder of git patches, they're usually better + # to review when the full message is viewed + if ($s =~ s/\n*---\n.*\z//s) { + $more = "$pfx...\n"; + } + # kill any trailing whitespace $s =~ s/\s+\z//s; # add prefix: $s =~ s/^/$pfx/sgm; - $rv .= $s . "\n"; + $rv .= $s . "\n$more"; ++$part_nr; }); -- EW