emacs-diffs
[Top][All Lists]
Advanced

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

master 7cd8108098c: Detect Git version on remote hosts separately from t


From: Dmitry Gutov
Subject: master 7cd8108098c: Detect Git version on remote hosts separately from the local one
Date: Mon, 7 Oct 2024 19:43:16 -0400 (EDT)

branch: master
commit 7cd8108098c08de47078db4e17291e5a529e0ae0
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>

    Detect Git version on remote hosts separately from the local one
    
    * 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'.
---
 lisp/vc/vc-git.el | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 05400523048..5a7ffeffc9d 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -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.



reply via email to

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