GNU bug report logs - #79276
[PATCH] Pass remote name explicitly in bug-reference-try-setup-from-vc

Previous Next

Package: emacs;

Reported by: André A. Gomes <andremegafone <at> gmail.com>

Date: Wed, 20 Aug 2025 09:17:01 UTC

Severity: normal

Tags: patch

Done: Tassilo Horn <tsdh <at> gnu.org>

Full log


Message #14 received at 79276 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "André A. Gomes" <andremegafone <at> gmail.com>,
 Philip Kaludercic <philipk <at> posteo.net>,
 "Basil L. Contovounesios" <basil <at> contovou.net>, 79276 <at> debbugs.gnu.org
Subject: Re: bug#79276: [PATCH] Pass remote name explicitly in
 bug-reference-try-setup-from-vc
Date: Wed, 20 Aug 2025 14:20:48 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi André,

>> 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.
>
> Adding Tassilo and Basil to the discussion.

I don't think that's appropriate because bug-reference calls the generic
`vc-call-backend' function but "origin" is a Git-specific name.  Other
version control systems might name it differently.  For example, in
mercurial the default remote is called "default", see vc-hg.el, so you'd
change semantics here.

But I get the point that "origin" is good name for "the remote which is
probably the central one that also hosts the bug-tracker".  Why not make
the patch

> 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" nil))))
>      (seq-some (lambda (config)
>                  (apply #'bug-reference-maybe-setup-from-vc url config))
>                (append bug-reference-setup-from-vc-alist

so that we ask for likely remote names first and then the default remote
name as defined by the VCS?

That would make things work fine also for hg where the "default" remote
is my own clone and the upstream is either called "upstream" or
"origin".

The downside is that in the Git case, we basically ask for "origin"
twice, once explicitly, once as default value for the optional argument.
But a "git config ..." call is not expensive so why bother.

Bye,
Tassilo




This bug report was last modified 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.