From 02da65ff3a35a36e86419a3494286a1eba233e89 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 10 Mar 2011 00:26:41 -0800 Subject: [PATCH] Add `vc-git-program' option; suggested on emacs-devel. * lisp/vc/vc-git.el (vc-git-program): New option. (vc-git-branches, vc-git-pull, vc-git-merge-branch, vc-git-command) (vc-git--call): Use it. --- lisp/ChangeLog | 4 ++++ lisp/vc/vc-git.el | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0499954465a..c8890a926be 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2011-03-10 Glenn Morris + * vc/vc-git.el (vc-git-program): New option. + (vc-git-branches, vc-git-pull, vc-git-merge-branch, vc-git-command) + (vc-git--call): Use it. + * eshell/esh-util.el (eshell-condition-case): Doc fix. * cus-edit.el (Custom-newline): If no button at point, look diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 3b4d0e5f421..711a573ba99 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -119,6 +119,12 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." :version "23.1" :group 'vc) +(defcustom vc-git-program "git" + "Name of the Git executable (excluding any arguments)." + :version "24.1" + :type 'string + :group 'vc) + (defcustom vc-git-root-log-format '("%d%h..: %an %ad %s" ;; The first shy group matches the characters drawn by --graph. @@ -554,7 +560,7 @@ or an empty string if none." "Return the existing branches, as a list of strings. The car of the list is the current branch." (with-temp-buffer - (call-process "git" nil t nil "branch") + (call-process vc-git-program nil t nil "branch") (goto-char (point-min)) (let (current-branch branches) (while (not (eobp)) @@ -633,13 +639,13 @@ for the Git command to run." (let* ((root (vc-git-root default-directory)) (buffer (format "*vc-git : %s*" (expand-file-name root))) (command "pull") - (git-program "git") + (git-program vc-git-program) args) ;; If necessary, prompt for the exact command. (when prompt (setq args (split-string (read-shell-command "Git pull command: " - "git pull" + (format "%s pull" git-program) 'vc-git-history) " " t)) (setq git-program (car args) @@ -663,7 +669,7 @@ This prompts for a branch to merge from." branches (cons "FETCH_HEAD" branches)) nil t))) - (apply 'vc-do-async-command buffer root "git" "merge" + (apply 'vc-do-async-command buffer root vc-git-program "merge" (list merge-source)) (vc-set-async-update buffer))) @@ -1083,8 +1089,10 @@ This command shares argument histories with \\[rgrep] and \\[grep]." (defun vc-git-command (buffer okstatus file-or-list &rest flags) "A wrapper around `vc-do-command' for use in vc-git.el. -The difference to vc-do-command is that this function always invokes `git'." - (apply 'vc-do-command (or buffer "*vc*") okstatus "git" file-or-list flags)) +The difference to vc-do-command is that this function always invokes +`vc-git-program'." + (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program + file-or-list flags)) (defun vc-git--empty-db-p () "Check if the git db is empty (no commit done yet)." @@ -1095,7 +1103,7 @@ The difference to vc-do-command is that this function always invokes `git'." ;; We don't need to care the arguments. If there is a file name, it ;; is always a relative one. This works also for remote ;; directories. - (apply 'process-file "git" nil buffer nil command args)) + (apply 'process-file vc-git-program nil buffer nil command args)) (defun vc-git--out-ok (command &rest args) (zerop (apply 'vc-git--call '(t nil) command args))) -- 2.39.2