Subject: bug#51316: 29.0.50; Should we match the final ".git" in bug-reference autosetup?

From: [email-masked]
Date: Thu, 21 Oct 2021 14:18:32 +0200

If function 'bug-reference--build-forge-setup-entry':

> `(,(concat "[/@]" host-domain "[/:]\\([.A-Za-z0-9_/-]+\\)\\.git")
This should be "(regexp-quote host-domain)".

Also, it would be nice if the final "\\.git" wasn't mandatory.  I often
git clone a website url as displayed in a web browser
("https://gitlab.com/rstocker/emacs-bluetooth" for example) without
appending ".git".  Git has no problem fetching from such an url (tested
with github, gitlab and gitea), but bug-reference autosetup machinery
fails to detect it as a valid url.

Unfortunately, we can't simply change the final .git into
"\\(?:\\.git\\)?" because regexp greediness would then swallow it into
the first match group.  Instead, something like this could work
(concat
 "[/@]" (regexp-quote host-domain)
 "\\(?:"
 "\\(?1:[.A-Za-z0-9_/-]+\\)\\.git\\|"
 "\\(?1:[.A-Za-z0-9_/-]+\\)"
 "\\)")

Thanks and best regards.

In GNU Emacs 29.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.17.4)