Re: [RFC PATCH] gitweb: improve title shortening heuristics
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 25, 2022, 01:30 UTC
- Message-ID
- <xmqqfsiq6ksb.fsf@gitster.g>
- In-Reply-To
- <20220724061231.jddhqns7bqx5c2xm@jrouhaud>
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);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).
The above code is all from 198066916a8 (Kay Sievers 2005-08-07), so it is very much understandable that its shortening heuristics no longer match reality.
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.