Subject: bug#79276: [PATCH] Pass remote name explicitly in bug-reference-try-setup-from-vc

From: André A. Gomes <[email-masked]>
Date: Wed, 20 Aug 2025 12:16:26 +0300

Tags: patch

Hi,

I investigated why bug-reference-mode's automatic setup wasn't doing
what I expected for some git repositories when the mode is enabled on
Magit buffers.  It turned out that, unsurprisingly, the inference
mechanism requires one of the remotes to the called "upstream" or
"origin" (since this condition didn't hold for the aforementioned
repositories, the conclusion follows).

Please find a trivial patch attached that makes this condition clearer.

It would make sense for Tassilo Horn or Basil L. Contovounesios to take
a look at the patch since they have touched on this functionality
recently.

Thank you.

-- 
André A. Gomes
"You cannot even find the ruins..."
>From aff9e615689ec4b277deedfb4c6de8a60ef2f82e Mon Sep 17 00:00:00 2001
From: "Andre A. Gomes" <[email-masked]>
Date: Wed, 20 Aug 2025 11:48:40 +0300
Subject: [PATCH] Pass remote name explicitly in
 bug-reference-try-setup-from-vc.

* lisp/progmodes/bug-reference.el (bug-reference-setup-from-vc-alist):
The call to vc-call-backend resolves to vc-git-repository-url, which
takes REMOTE-NAME as an optional argument.  Its default value is
"origin" so let's pass it explicitly for clarity.
---
 lisp/progmodes/bug-reference.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index 5c03c949049..02acac154ee 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -393,7 +393,7 @@ bug-reference-try-setup-from-vc
                                (ignore-errors
                                  (vc-call-backend backend 'repository-url
                                                   file-or-dir remote)))
-                             '("upstream" nil))))
+                             '("upstream" "origin"))))
     (seq-some (lambda (config)
                 (apply #'bug-reference-maybe-setup-from-vc url config))
               (append bug-reference-setup-from-vc-alist
-- 
2.48.1