link commit hashes in the archives

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: pgsql-www(at)lists(dot)postgresql(dot)org
Subject: link commit hashes in the archives
Date: 2026-12-03 21:12:17
Message-ID: axHbMTRyzXsoEOnE@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-www

I was wondering how difficult it would be to teach the mailing list
archives to turn things that look like commit hashes into links to
https://postgr.es/c/<hash>, and it turned out to be pretty easy. The
attached (LLM-generated) patch adds a template filter to pgarchives that
does this for message bodies. AFAICT this hasn't come up before.

Nothing checks that the commit actually exists. The filter just looks for
7 to 40 hex digits that aren't part of a longer token (e.g., a message-id
or file name), and it skips strings that are all digits or all letters, as
well as the "index" lines of inline diffs. It's also limited to threads on
-hackers, -bugs, -committers, and -docs, since hashes on other lists are
less likely to be PostgreSQL commits. I had an LLM test it on 885 recent
messages from those lists, and it linked all 351 real references along with
4 false positives.

There are a couple of caveats. Skipping all-numbers hashes misses ~1% of
real 10-character hashes, and short hashes can be ambiguous. An
alternative approach could be to keep a table of commits and check that
each one is there, but that felt like it might be more trouble than it's
worth.

Thoughts? I would find this particularly handy, as I often find myself
manually copying git hashes to the end of "https://postgr.es/c/" in my
browser.

--
nathan

Attachment Content-Type Size
v1-0001-Link-commit-hashes-in-message-bodies.patch text/plain 4.4 KB

Browse pgsql-www by date

  From Date Subject
Previous Message Lukas Fittl 2026-12-03 17:36:22 Re: Can the "pgautoupgrade" docker project/image be listed on our Download page?