git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] gitweb: improve title shortening heuristics

From
JRJulien Rouhaud <rjuju123@gmail.com>
Date
Jul 25, 2022, 02:12 UTC
Message-ID
<20220725020534.x33hso22ab2dwyo7@jrouhaud>
In-Reply-To
<xmqqfsiq6ksb.fsf@gitster.g>
On Sun, Jul 24, 2022 at 06:30:44PM -0700, Junio C Hamano wrote:
Show 27 quoted lines
> Julien Rouhaud <rjuju123@gmail.com> writes:
>
> > Otherwise, would it be acceptable to disable the whole block (the "remove
> > leading stuff of merges to make the interesting part visible") with some new
> > configuration option?
>
> I personally find that "shortening" logic way too specific to the
> kernel project hosted at kernel.org and would be inappropriate to
> use it anywhere else.
>
> 	if (length($title) > 50) {
> 		$title =~ s/^Automatic //;
> 		$title =~ s/^merge (of|with) /Merge ... /i;
> 		if (length($title) > 50) {
> 			$title =~ s/(http|rsync):\/\///;
> 		}
> 		if (length($title) > 50) {
> 			$title =~ s/(master|www|rsync)\.//;
> 		}
> 		if (length($title) > 50) {
> 			$title =~ s/kernel.org:?//;
> 		}
> 		if (length($title) > 50) {
> 			$title =~ s/\/pub\/scm//;
> 		}
> 	}
> 	$co{'title_short'} = chop_str($title, 50, 5);

That's probably true, although some parts (like the protocol) seemed general enough to me to be worth considering for general use case, and some of the really specific parts seems so specific that they shouldn't really matter if used outside kernel.org.

Show 11 quoted lines
>
> Of course, http:// and rsync:// are way outdated (https://, ssh://
> and git:// are probably reasonable).  Equally outdated is to merge
> branches from master.kernel.org, www.kernel.org, or rsync.kernel.org
> (many merges are recorded as pulling from git://git.kernel.org/ or
> https://git.kernel.org/ these days).
>
> Even worse, I somehow thought that kernel.org no longer uses gitweb
> but uses something else.  So I suspect that nobody sheds tears if we
> remove the whole block unconditionally.  In fact, it would make the
> world a better place.

Well, I'm obviously totally fine with getting rid of it. FWIW, even the protocol part wouldn't change anything for the instance hosted by postgres.

I'm attaching an updated v2 patch that removes all that logic and just keeps the title_short chopped at 50 chars.

From ea4f31c0a2276f042322a11e258e55223863cd35 Mon Sep 17 00:00:00 2001
From: Julien Rouhaud <julien.rouhaud@free.fr>
Date: Sun, 24 Jul 2022 13:17:19 +0800
Subject: [PATCH v2] gitweb: Remove title_short shortening heuristics

Those heuristics are way outdated and too general to be useful outside of kernel.org. Since kernel.org doesn't use gitweb anymore and at least one project complained about incorrect behavior, entirely remove them.

Signed-off-by: Julien Rouhaud <julien.rouhaud@free.fr>
---
 gitweb/gitweb.perl | 17 -----------------
 1 file changed, 17 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1835487ab2..e66eb3d9ba 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3560,23 +3560,6 @@ sub parse_commit_text {
 		$title =~ s/^    //;
 		if ($title ne "") {
 			$co{'title'} = chop_str($title, 80, 5);
-			# remove leading stuff of merges to make the interesting part visible
-			if (length($title) > 50) {
-				$title =~ s/^Automatic //;
-				$title =~ s/^merge (of|with) /Merge ... /i;
-				if (length($title) > 50) {
-					$title =~ s/(http|rsync):\/\///;
-				}
-				if (length($title) > 50) {
-					$title =~ s/(master|www|rsync)\.//;
-				}
-				if (length($title) > 50) {
-					$title =~ s/kernel.org:?//;
-				}
-				if (length($title) > 50) {
-					$title =~ s/\/pub\/scm//;
-				}
-			}
 			$co{'title_short'} = chop_str($title, 50, 5);
 			last;
 		}
-- 
2.37.0
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 3 of 7 in “gitweb: improve title shortening heuristics”
  1. gitweb: improve title shortening heuristicsJulien Rouhaud, Jul 24, 2022
  2. Junio C HamanoJul 25, 2022
  3. Julien RouhaudJul 25, 2022
  4. Ævar Arnfjörð BjarmasonJul 25, 2022
  5. Julien RouhaudJul 26, 2022
  6. Junio C HamanoJul 27, 2022
  7. Julien RouhaudJul 28, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.