GNU bug report logs - #50689
28.0.50; Wrong VC repo URL detection in bug-reference-mode

Previous Next

Package: emacs;

Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Date: Sun, 19 Sep 2021 23:44:02 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50689 in the body.
You can then email your comments to 50689 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to tsdh <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#50689; Package emacs. (Sun, 19 Sep 2021 23:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Basil L. Contovounesios" <contovob <at> tcd.ie>:
New bug report received and forwarded. Copy sent to tsdh <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Sun, 19 Sep 2021 23:44:02 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Wrong VC repo URL detection in bug-reference-mode
Date: Mon, 20 Sep 2021 00:43:07 +0100
[Message part 1 (text/plain, inline)]
Tags: patch

In a clone of https://github.com/abo-abo/swiper.git, with the following
remotes:

    $ git remote -v
    elpa	savannah:/srv/git/emacs/elpa.git (fetch)
    elpa	savannah:/srv/git/emacs/elpa.git (push)
    origin	git <at> github.com:basil-conto/swiper.git (fetch)
    origin	git <at> github.com:basil-conto/swiper.git (push)
    upstream	git <at> github.com:abo-abo/swiper.git (fetch)
    upstream	git <at> github.com:abo-abo/swiper.git (push)

0. emacs -Q ivy.el
1. M-: (vc-call-backend 'Git 'repository-url "upstream") RET

This returns: "git <at> github.com:basil-conto/swiper.git"
instead of:   "git <at> github.com:abo-abo/swiper.git"

Step 1 is effectively what bug-reference-try-setup-from-vc does, and I
believe the incorrect result is due to vc-git-repository-url expecting a
file name, not a Git remote name, as its first argument.

How's the attached fix?

[0001-Fix-VC-repo-URL-detection-in-bug-reference-mode.patch (text/x-diff, inline)]
From dd1be2b9c277a53078fb20242702ecf2599cbb7b Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Sun, 19 Sep 2021 21:13:17 +0100
Subject: [PATCH 1/2] Fix VC repo URL detection in bug-reference-mode

* lisp/progmodes/bug-reference.el (bug-reference-try-setup-from-vc):
Pass file or directory name in question as the first argument to the
backend's repository-url implementation.  Use when-let and seq-some
to flatten nested conditionals.
---
 lisp/progmodes/bug-reference.el | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index b646a47c85..fd014a38d9 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -376,24 +376,19 @@ bug-reference-try-setup-from-vc
 Test each configuration in `bug-reference-setup-from-vc-alist'
 and `bug-reference--setup-from-vc-alist' and apply it if
 applicable."
-  (let ((file-or-dir (or buffer-file-name
-                         ;; Catches modes such as vc-dir and Magit.
-                         default-directory)))
-    (when file-or-dir
-      (let* ((backend (vc-responsible-backend file-or-dir t))
-             (url
-              (or (ignore-errors
-                    (vc-call-backend backend 'repository-url "upstream"))
-                  (ignore-errors
-                    (vc-call-backend backend 'repository-url)))))
-        (when url
-          (catch 'found
-            (dolist (config (append
-                             bug-reference-setup-from-vc-alist
-                             (bug-reference--setup-from-vc-alist)))
-              (when (apply #'bug-reference-maybe-setup-from-vc
-                           url config)
-                (throw 'found t)))))))))
+  (when-let ((file-or-dir (or buffer-file-name
+                              ;; Catches modes such as vc-dir and Magit.
+                              default-directory))
+             (backend (vc-responsible-backend file-or-dir t))
+             (url (seq-some (lambda (remote)
+                              (ignore-errors
+                                (vc-call-backend backend 'repository-url
+                                                 file-or-dir remote)))
+                            '("upstream" nil))))
+    (seq-some (lambda (config)
+                (apply #'bug-reference-maybe-setup-from-vc url config))
+              (append bug-reference-setup-from-vc-alist
+                      (bug-reference--setup-from-vc-alist)))))
 
 (defvar bug-reference-setup-from-mail-alist
   `((,(regexp-opt '("emacs" "auctex" "gnus" "tramp" "orgmode") 'words)
-- 
2.33.0

[Message part 3 (text/plain, inline)]
Thanks,

-- 
Basil

In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2021-09-20 built on tia
Repository revision: 3c513435369826e44a53dcb12ecc14657e03c73d
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure 'CC=ccache gcc' 'CFLAGS=-Og -ggdb' --config-cache
 --prefix=/home/blc/.local --enable-checking=structs
 --with-x-toolkit=lucid --with-file-notification=yes --with-x'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(vc-git diff-mode easy-mmode vc-dispatcher help-mode pp shadow sort
mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 57729 7685)
 (symbols 48 7242 5)
 (strings 32 21156 1629)
 (string-bytes 1 675261)
 (vectors 16 14813)
 (vector-slots 8 196771 13743)
 (floats 8 31 55)
 (intervals 56 350 15)
 (buffers 992 12))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50689; Package emacs. (Mon, 20 Sep 2021 07:15:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 50689 <at> debbugs.gnu.org
Subject: Re: bug#50689: 28.0.50; Wrong VC repo URL detection in
 bug-reference-mode
Date: Mon, 20 Sep 2021 08:45:18 +0200
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

Hey Basil,

> Tags: patch
>
> In a clone of https://github.com/abo-abo/swiper.git, with the following
> remotes:
>
>     $ git remote -v
>     elpa	savannah:/srv/git/emacs/elpa.git (fetch)
>     elpa	savannah:/srv/git/emacs/elpa.git (push)
>     origin	git <at> github.com:basil-conto/swiper.git (fetch)
>     origin	git <at> github.com:basil-conto/swiper.git (push)
>     upstream	git <at> github.com:abo-abo/swiper.git (fetch)
>     upstream	git <at> github.com:abo-abo/swiper.git (push)
>
> 0. emacs -Q ivy.el
> 1. M-: (vc-call-backend 'Git 'repository-url "upstream") RET
>
> This returns: "git <at> github.com:basil-conto/swiper.git"
> instead of:   "git <at> github.com:abo-abo/swiper.git"
>
> Step 1 is effectively what bug-reference-try-setup-from-vc does, and I
> believe the incorrect result is due to vc-git-repository-url expecting
> a file name, not a Git remote name, as its first argument.

Oh, good catch!

BTW, I've thought I've checked that previously <fork>/issues/X
redirected you to <originalrepo>/issues/X but that doesn't seem to be
the case right anymore...

> How's the attached fix?

LGTM.  Not sure about when-let/seq-fns.  I refrained from using them in
bug-reference.el so that it doesn't require subr-x.el and seq.el.  But
OTHO, I very much like them and would happily use them once they are
loaded anyway.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50689; Package emacs. (Mon, 20 Sep 2021 13:54:02 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 50689 <at> debbugs.gnu.org
Subject: Re: bug#50689: 28.0.50; Wrong VC repo URL detection in
 bug-reference-mode
Date: Mon, 20 Sep 2021 14:53:32 +0100
close 50689 28.1
quit

Tassilo Horn [2021-09-20 08:45 +0200] wrote:

> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>> How's the attached fix?
>
> LGTM.

Thanks, pushed:

Fix VC repo URL detection in bug-reference-mode
7d5930a6f0 2021-09-20 14:41:13 +0100
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=7d5930a6f0c7b44c00df403d5fe8a3f40e51902f

> Not sure about when-let/seq-fns.  I refrained from using them in
> bug-reference.el so that it doesn't require subr-x.el and seq.el.

when-let is an autoloaded macro, so subr-x.el won't be loaded at all at
runtime (assuming everything is byte-compiled).

seq-some is an autoloaded function, so seq.el won't be loaded until
bug-reference-try-setup-from-vc is invoked (and anyway in practice it is
hard to do anything in Emacs any more without seq.el being loaded at
some point).

> But OTHO, I very much like them and would happily use them once they
> are loaded anyway.

I'm therefore closing this report.

Thanks,

-- 
Basil




bug marked as fixed in version 28.1, send any further explanations to 50689 <at> debbugs.gnu.org and "Basil L. Contovounesios" <contovob <at> tcd.ie> Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Mon, 20 Sep 2021 13:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50689; Package emacs. (Mon, 20 Sep 2021 13:59:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 50689 <at> debbugs.gnu.org
Subject: Re: bug#50689: 28.0.50; Wrong VC repo URL detection in
 bug-reference-mode
Date: Mon, 20 Sep 2021 15:57:13 +0200
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

>> Not sure about when-let/seq-fns.  I refrained from using them in
>> bug-reference.el so that it doesn't require subr-x.el and seq.el.
>
> when-let is an autoloaded macro, so subr-x.el won't be loaded at all
> at runtime (assuming everything is byte-compiled).

Ah, right.

> seq-some is an autoloaded function, so seq.el won't be loaded until
> bug-reference-try-setup-from-vc is invoked (and anyway in practice it
> is hard to do anything in Emacs any more without seq.el being loaded
> at some point).

Allright with me.

Thanks a lot!
Tassilo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 19 Oct 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 183 days ago.

Previous Next


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