unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65315: 30.0.50; vc-dir fails with Git < 2.7.0
@ 2023-08-15 18:52 Bob Rogers
  2023-08-16  1:33 ` Dmitry Gutov
  0 siblings, 1 reply; 3+ messages in thread
From: Bob Rogers @ 2023-08-15 18:52 UTC (permalink / raw)
  To: 65315

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 1937 bytes --]

   1.  On a system with a version of Git older than 2.7.0, navigate to a
git-controlled directory and invoke "emacs -Q".

   2.  With this as the default directory, invoke vc-dir.  This fails
with the error "vc-do-command: Failed (status 129): git --no-pager
remote get-url origin ."

   This is because the "get-url" subcommand of "git remote", used by
vc-git-repository-url, was added in 2.7.0 [1].  The attached patch
against master rev 1db7e8eba961e88181879213dd5374ad9e87ac76 uses "git
config" in a way that works in both old and new systems (tested with git
2.1.2 and git 2.35.3).

   Of course, supporting 7+-year-old versions of git is probably not a
high priority, so I won't be too disappointed if this fix is rejected.
On the other hand, it's a small change, and having vc-dir fail on any
system, especially when using Git, puts a big damper on being able to
use Emacs to hack on things in older systems, so I think it's worth
having.

					-- Bob Rogers
					   http://www.rgrjr.com/

[1]  https://github.com/git/git/blob/master/Documentation/RelNotes/2.7.0.txt,
     line 13.

------------------------------------------------------------------------
In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.16.0) of 2023-08-15 built on orion
Repository revision: 1db7e8eba961e88181879213dd5374ad9e87ac76
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: openSUSE Leap 15.5

Configured using:
 'configure --with-dbus=no --with-gsettings=no --with-gif=ifavailable
 --with-tiff=no --with-gnutls=yes --with-gconf=no'

Configured features:
ACL CAIRO FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBSELINUX LIBXML2
MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS
TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix


[-- Attachment #2: Type: text/x-patch, Size: 887 bytes --]

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index dfca944dc74..a7763360795 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1342,8 +1342,10 @@ vc-git-conflicted-files
 (defun vc-git-repository-url (file-or-dir &optional remote-name)
   (let ((default-directory (vc-git-root file-or-dir)))
     (with-temp-buffer
-      (vc-git-command (current-buffer) 0 nil "remote" "get-url"
-                      (or remote-name "origin"))
+      ;; The "get-url" subcommand of "git remote" was new in git 2.7.0;
+      ;; "git config" also works in older versions.  -- rgr, 15-Aug-23.
+      (let ((opt-name (concat "remote." (or remote-name "origin") ".url")))
+	(vc-git-command (current-buffer) 0 (list "config" "--get" opt-name)))
       (buffer-substring-no-properties (point-min) (1- (point-max))))))
 
 ;; Everywhere but here, follows vc-git-command, which uses vc-do-command

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#65315: 30.0.50; vc-dir fails with Git < 2.7.0
  2023-08-15 18:52 bug#65315: 30.0.50; vc-dir fails with Git < 2.7.0 Bob Rogers
@ 2023-08-16  1:33 ` Dmitry Gutov
  2023-08-16  1:51   ` Bob Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Gutov @ 2023-08-16  1:33 UTC (permalink / raw)
  To: Bob Rogers, 65315-done

Version: 30.1

On 15/08/2023 21:52, Bob Rogers wrote:
>     1.  On a system with a version of Git older than 2.7.0, navigate to a
> git-controlled directory and invoke "emacs -Q".
> 
>     2.  With this as the default directory, invoke vc-dir.  This fails
> with the error "vc-do-command: Failed (status 129): git --no-pager
> remote get-url origin ."
> 
>     This is because the "get-url" subcommand of "git remote", used by
> vc-git-repository-url, was added in 2.7.0 [1].  The attached patch
> against master rev 1db7e8eba961e88181879213dd5374ad9e87ac76 uses "git
> config" in a way that works in both old and new systems (tested with git
> 2.1.2 and git 2.35.3).

Thanks! Pushed to master.

>     Of course, supporting 7+-year-old versions of git is probably not a
> high priority, so I won't be too disappointed if this fix is rejected.
> On the other hand, it's a small change, and having vc-dir fail on any
> system, especially when using Git, puts a big damper on being able to
> use Emacs to hack on things in older systems, so I think it's worth
> having.

I'm not a fan of spending too much time on older versions myself, but 
the patch is indeed small, and we're still making allowances for 
versions older than that still.

Speaking of older systems, though, I would hope they have similarly old 
repositories with suitably old Emacs versions (or, if you build from 
source, there is a respective tag in the repo). We do have to drop 
compatibilities when stuff is old enough.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#65315: 30.0.50; vc-dir fails with Git < 2.7.0
  2023-08-16  1:33 ` Dmitry Gutov
@ 2023-08-16  1:51   ` Bob Rogers
  0 siblings, 0 replies; 3+ messages in thread
From: Bob Rogers @ 2023-08-16  1:51 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 65315-done

   From: Dmitry Gutov <dmitry@gutov.dev>
   Date: Wed, 16 Aug 2023 04:33:04 +0300

   . . .

   I'm not a fan of spending too much time on older versions myself, but 
   the patch is indeed small, and we're still making allowances for 
   versions older than that still.

Great; thank you.

   Speaking of older systems, though, I would hope they have similarly
   old repositories with suitably old Emacs versions (or, if you build
   from source, there is a respective tag in the repo).  We do have to
   drop compatibilities when stuff is old enough.

Understood.  I have been building emacs from master in order to have all
my latest customizations on this system; really what I suppose I ought
to do is create a branch (or two) of my customizations and revert the
relevant updates.  Fortunately, I no longer need to hack on this system
very often.

					-- Bob





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-16  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-15 18:52 bug#65315: 30.0.50; vc-dir fails with Git < 2.7.0 Bob Rogers
2023-08-16  1:33 ` Dmitry Gutov
2023-08-16  1:51   ` Bob Rogers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).