From 92551202a2e6043dd1e56dcbfd89f6415c6ef951 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 8 Oct 2024 02:42:39 +0300 Subject: [PATCH] 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'. (cherry picked from commit 7cd8108098c08de47078db4e17291e5a529e0ae0) --- 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. -- 2.39.5