]> git.eshelyaron.com Git - emacs.git/commitdiff
Detect Git version on remote hosts separately from the local one
authorDmitry Gutov <dmitry@gutov.dev>
Mon, 7 Oct 2024 23:42:39 +0000 (02:42 +0300)
committerEshel Yaron <me@eshelyaron.com>
Mon, 14 Oct 2024 17:34:51 +0000 (19:34 +0200)
* lisp/vc/vc-git.el (vc-git--program-version): Detect Git version
on remote hosts separately from the local one (buf#73320).
(vc-git-connection-default-profile): Set up collection-local
profile.  And use it for the 'vc-git' :application.
(vc-git--program-version): Operate on the connection-local value
of 'vc-git--program-version'.

(cherry picked from commit 7cd8108098c08de47078db4e17291e5a529e0ae0)

lisp/vc/vc-git.el

index 05400523048ac11a022141fecd9142245d811f94..5a7ffeffc9d15ada5684746600e490d0f6cc5976 100644 (file)
@@ -315,11 +315,21 @@ Good example of file name that needs this: \"test[56].xx\".")
 
 (defvar vc-git--program-version nil)
 
+(connection-local-set-profile-variables
+ 'vc-git-connection-default-profile
+ '((vc-git--program-version . nil)))
+
+(connection-local-set-profiles
+ '(:application vc-git)
+ 'vc-git-connection-default-profile)
+
 (defun vc-git--program-version ()
-  (or vc-git--program-version
-      (let ((version-string
-             (vc-git--run-command-string nil "version")))
-        (setq vc-git--program-version
+  (with-connection-local-application-variables 'vc-git
+   (or vc-git--program-version
+       (let ((version-string
+              (vc-git--run-command-string nil "version")))
+         (setq-connection-local
+              vc-git--program-version
               (if (and version-string
                        ;; Some Git versions append additional strings
                        ;; to the numerical version string. E.g., Git
@@ -329,7 +339,7 @@ Good example of file name that needs this: \"test[56].xx\".")
                        (string-match "git version \\([0-9][0-9.]+\\)"
                                      version-string))
                   (string-trim-right (match-string 1 version-string) "\\.")
-                "0")))))
+                "0"))))))
 
 (defun vc-git--git-path (&optional path)
   "Resolve .git/PATH for the current working tree.