emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 612f25c24ff: Don't use the too-new command 'git get-url'


From: Dmitry Gutov
Subject: master 612f25c24ff: Don't use the too-new command 'git get-url'
Date: Tue, 15 Aug 2023 21:21:00 -0400 (EDT)

branch: master
commit 612f25c24ff08b9343ec8897c8dbcfc02d9b0d07
Author: Bob Rogers <rogers@rgrjr.com>
Commit: Dmitry Gutov <dmitry@gutov.dev>

    Don't use the too-new command 'git get-url'
    
    * lisp/vc/vc-git.el (vc-git-repository-url):
    Don't use the too-new command 'git get-url' (bug#65315).
---
 lisp/vc/vc-git.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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 @@ This prompts for a branch to merge from."
 (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]