Subject: [ANNOUNCE] Button "Copy commit reference" for Git hosting sites

From: Andrei Rybak <[email-masked]>
Date: Wed, 18 Sep 2024 03:41:14 +0200

I am pleased to announce "Git: copy commit reference" -- a collection of
userscripts, which make it easy to copy-paste commit references from
web UIs of the Git hosting providers.  Example of a commit reference:

	1f0fc1d (pretty: implement 'reference' format, 2019-11-20)

Such references are a good way of providing context in commit
messages.[1]  The main goal of the project is to allow users of Git
hosting sites to produce better commit messages by giving them an easy,
one-click way of creating commit references using websites of the
hosting providers.  Here's a screenshot of how the button looks on
GitHub, for example:

	https://raw.githubusercontent.com/rybak/copy-commit-reference-userscript/main/Documentation/GitHub.png

How to install?
===============

Try the userscripts out by installing them via Greasy Fork:

	https://greasyfork.org/en/scripts?set=588773

If you are not familiar with userscripts for browsers, they are like
extensions inside another browser extension, called a user script
manager.[2]

What do the userscripts do?
===========================

The userscripts add a button "Copy commit reference" to commit pages of
Git hosting sites.  Clicking the button puts both plain text and HTML
into the clipboard.  The HTML content has clickable links to the
website.  This is useful in rich text editors, e.g. in HTML emails,
Slack, MS Teams, Confluence, visual mode of Jira, etc.

Which sites are supported?
==========================

The following hosting providers are supported at the time of writing:

   - GitHub
   - GitLab
   - Bitbucket Cloud and Bitbucket Server
   - Gitea and Forgejo
   - Phorge (fork of Phabricator)
   - Gitiles
   - Sourcehut
   - Cgit
   - GitWeb
   - Gogs

Development notes
=================

Adding support for following Git hosting providers is planned [3]:

   - RhodeCode
   - Pagure
   - GitBucket

If your favorite hosting is missing from the list you can leave feedback
at the issue trackers.[3]

During development I found that compatibility with a wide range of
versions of the websites can be tricky.  Examples:

   - The latest version of GitWeb is easily available to anyone with
     `git instaweb`, but one of the well-known public instances --
     https://repo.or.cz/ -- runs version 2.11.4 with custom patches.
     Thankfully, the differences relevant to the userscript don't make
     it too hard to support both versions.

   - Public instances of Gitea/Forgejo have a very wide range of
     versions, with slightly different HTML layout, and often with custom
     patches.

   - As far as I know, there are no public (even read-only) instances of
     Bitbucket Server.  I did manage to test the userscript on several
     private instances with versions in the range v7.21.* -- v8.9.*.

If you know publicly available instances of any of the Git hostings
listed above (especially Bitbucket Server), please let me know.

I originally planned to post this to git-users mailing list, but it's
gone now. See <https://github.com/git/git-scm.com/pull/1829> for
details.

Footnotes
=========

[1] 
https://lore.kernel.org/git/52[email-masked]/#
[2] https://greasyfork.org/en/help/installing-user-scripts
[3] Issues are tracked mostly on GitHub:
       https://github.com/rybak/copy-commit-reference-userscript/issues
     but other sites are also available:
       https://gitlab.com/andrybak/copy-commit-reference-userscript/-/issues
       https://gitea.com/andrybak/copy-commit-reference-userscript/issues
       https://codeberg.org/andrybak/copy-commit-reference-userscript/issues