summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-12-11 09:53:12 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-12-11 09:53:12 +0000
commitb4a2d51e57b1f50db4b9e489652daf35f1e583d0 (patch)
treeec0ce579ca82b5498ee579f415cc81d838702dd2
parent37a4dce4bc5b38a686516e22d0dc81a90b757d91 (diff)
downloadzsh-b4a2d51e57b1f50db4b9e489652daf35f1e583d0.tar.gz
zsh-b4a2d51e57b1f50db4b9e489652daf35f1e583d0.tar.xz
zsh-b4a2d51e57b1f50db4b9e489652daf35f1e583d0.zip
Frank Terbeck: 26125: add "command" style to VCS_INFO
-rw-r--r--ChangeLog24
-rw-r--r--Doc/Zsh/contrib.yo20
-rw-r--r--Functions/VCS_Info/.distfiles1
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_cdv2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_cvs2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_darcs2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_git4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_hg2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_mtn2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_p46
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_svk2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_svn2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_tla4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git6
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn2
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_p44
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_svn4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_tla2
-rw-r--r--Functions/VCS_Info/VCS_INFO_check_com9
-rw-r--r--Functions/VCS_Info/VCS_INFO_get_cmd6
-rw-r--r--Functions/VCS_Info/vcs_info2
22 files changed, 86 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index c91ceb9bf..c821ce495 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2008-12-11  Peter Stephenson  <pws@csr.com>
+
+	* Frank Terbeck: 26125: Doc/Zsh/contrib.yo,
+	Functions/VCS_Info/.distfiles,
+	Functions/VCS_Info/VCS_INFO_check_com,
+	Functions/VCS_Info/VCS_INFO_get_cmd, Functions/VCS_Info/vcs_info,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_cdv,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_cvs,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_darcs,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_git,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_hg,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_mtn,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_p4,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_svk,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_svn,
+	Functions/VCS_Info/Backends/VCS_INFO_detect_tla,
+	Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr,
+	Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
+	Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn,
+	Functions/VCS_Info/Backends/VCS_INFO_get_data_p4,
+	Functions/VCS_Info/Backends/VCS_INFO_get_data_svn,
+	Functions/VCS_Info/Backends/VCS_INFO_get_data_tla: add
+	"command" style for VCS command to use.
+
 2008-12-10  Peter Stephenson  <pws@csr.com>
 
 	* 26121: Doc/Zsh/calsys.yo, Functions/Calendar/calendar: add
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 4c2c7abc7..c393d2895 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -506,6 +506,25 @@ A list of VCSs, you don't want var(vcs_info) to test for
 repositories (checked in the var(-init-) context, too). Only used if
 tt(enable) contains tt(ALL).
 )
+kindex(command)
+item(tt(command))(
+This style causes var(vcs_info) to use the supplied string as the command
+to use as the vcs's binary. Note, that setting this in ':vcs_info:*' is
+not a good idea.
+
+If the value of this style is empty (which is the default), the used binary
+name is the name of the backend in use (e.g. var(svn) is used in a var(svn)
+repository).
+
+The var(repo-root-name) part in the context is always the default tt(-all-)
+when this style is looked up.
+
+For example, this style can be used to use binaries from non-default
+installation directories. Assume, var(git) is installed in /usr/bin, but
+your sysadmin installed a newer version in /usr/bin/local. Now, instead of
+changing the order of your tt($PATH) parameter, you can do this:
+example(zstyle ':vcs_info:git:*:-all-' command /usr/local/bin/git)
+)
 kindex(use-server)
 item(tt(use-server))(
 This is used by the Perforce backend (tt(p4)) to decide if it should
@@ -547,6 +566,7 @@ sitem(tt(nvcsformats))("")
 sitem(tt(max-exports))(2)
 sitem(tt(enable))(ALL)
 sitem(tt(disable))((empty list))
+sitem(tt(command))((empty string))
 sitem(tt(use-simple))(false)
 sitem(tt(use-prompt-escapes))(true)
 endsitem()
diff --git a/Functions/VCS_Info/.distfiles b/Functions/VCS_Info/.distfiles
index b4118ac80..879aa1eda 100644
--- a/Functions/VCS_Info/.distfiles
+++ b/Functions/VCS_Info/.distfiles
@@ -5,6 +5,7 @@ VCS_INFO_adjust
 VCS_INFO_bydir_detect
 VCS_INFO_check_com
 VCS_INFO_formats
+VCS_INFO_get_cmd
 vcs_info_lastmsg
 VCS_INFO_maxexports
 VCS_INFO_nvcsformats
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_cdv b/Functions/VCS_Info/Backends/VCS_INFO_detect_cdv
index 356bd069c..a0324533a 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_cdv
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_cdv
@@ -6,7 +6,7 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && return 1
 
-VCS_INFO_check_com cdv || return 1
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
 vcs_comm[detect_need_file]=format
 VCS_INFO_bydir_detect '.cdv'
 return $?
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
index 61b43cc43..7a5ee1eef 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
@@ -6,6 +6,6 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && return 1
 
-VCS_INFO_check_com svn || return 1
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
 [[ -d "./CVS" ]] && [[ -r "./CVS/Repository" ]] && return 0
 return 1
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_darcs b/Functions/VCS_Info/Backends/VCS_INFO_detect_darcs
index 942d8afbb..1e3f5476e 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_darcs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_darcs
@@ -6,7 +6,7 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && return 1
 
-VCS_INFO_check_com darcs || return 1
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
 vcs_comm[detect_need_file]=format
 VCS_INFO_bydir_detect '_darcs'
 return $?
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_git b/Functions/VCS_Info/Backends/VCS_INFO_detect_git
index 627b8cf23..61bc483e3 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_git
@@ -6,8 +6,8 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && { print -l git-p4 git-svn; return 0 }
 
-if VCS_INFO_check_com git && git rev-parse --is-inside-work-tree &> /dev/null ; then
-    vcs_comm[gitdir]="$(git rev-parse --git-dir 2> /dev/null)" || return 1
+if VCS_INFO_check_com ${vcs_comm[cmd]} && ${vcs_comm[cmd]} rev-parse --is-inside-work-tree &> /dev/null ; then
+    vcs_comm[gitdir]="$(${vcs_comm[cmd]} rev-parse --git-dir 2> /dev/null)" || return 1
     if   [[ -d ${vcs_comm[gitdir]}/svn ]]             ; then vcs_comm[overwrite_name]='git-svn'
     elif [[ -d ${vcs_comm[gitdir]}/refs/remotes/p4 ]] ; then vcs_comm[overwrite_name]='git-p4' ; fi
     return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_hg b/Functions/VCS_Info/Backends/VCS_INFO_detect_hg
index 8a6c0c8a6..41fcc4b4c 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_hg
@@ -6,7 +6,7 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && return 1
 
-VCS_INFO_check_com hg || return 1
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
 vcs_comm[detect_need_file]=branch
 VCS_INFO_bydir_detect '.hg'
 return $?
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_mtn b/Functions/VCS_Info/Backends/VCS_INFO_detect_mtn
index cb0fec1bd..3f88ba2ea 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_mtn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_mtn
@@ -6,7 +6,7 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && return 1
 
-VCS_INFO_check_com mtn || return 1
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
 vcs_comm[detect_need_file]=revision
 VCS_INFO_bydir_detect '_MTN'
 return $?
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
index d9475fa01..377453f6a 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
@@ -21,7 +21,7 @@ VCS_INFO_p4_get_server() {
   setopt extendedglob
 
   local -a settings
-  settings=(${(f)"$(p4 set)"})
+  settings=(${(f)"$(${vcs_comm[cmd]} set)"})
   serverport=${${settings[(r)P4PORT=*]##P4PORT=}%% *}
   case $serverport in
     (''|:)
@@ -54,7 +54,7 @@ VCS_INFO_detect_p4() {
       VCS_INFO_p4_get_server
       [[ -n $vcs_info_p4_dead_servers[$serverport] ]] && return 1
     fi
-    if p4where="$(p4 where 2>&1)"; then
+    if p4where="$(${vcs_comm[cmd]} where 2>&1)"; then
       return 0
     fi
     if [[ $p4where = *"Connect to server failed"* ]]; then
@@ -67,7 +67,7 @@ VCS_INFO_detect_p4() {
     return 1
   else
     [[ -n ${P4CONFIG} ]] || return 1
-    VCS_INFO_check_com p4 || return 1
+    VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
     vcs_comm[detect_need_file]="${P4CONFIG}"
     VCS_INFO_bydir_detect .
     return $?
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_svk b/Functions/VCS_Info/Backends/VCS_INFO_detect_svk
index 476b59101..e21b2dd73 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_svk
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_svk
@@ -17,7 +17,7 @@ setopt localoptions noksharrays extendedglob
 local -i fhash
 fhash=0
 
-VCS_INFO_check_com svk || return 1
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
 [[ -f ~/.svk/config ]] || return 1
 
 while IFS= read -r line ; do
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_svn b/Functions/VCS_Info/Backends/VCS_INFO_detect_svn
index f22c34ee5..bb9d083ac 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_svn
@@ -6,6 +6,6 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && return 1
 
-VCS_INFO_check_com svn || return 1
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
 [[ -d ".svn" ]] && return 0
 return 1
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_tla b/Functions/VCS_Info/Backends/VCS_INFO_detect_tla
index 3b2042897..ac4dbd736 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_tla
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_tla
@@ -6,6 +6,6 @@ setopt localoptions NO_shwordsplit
 
 [[ $1 == '--flavours' ]] && return 1
 
-VCS_INFO_check_com tla || return 1
-vcs_comm[basedir]="$(tla tree-root 2> /dev/null)" && return 0
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
+vcs_comm[basedir]="$(${vcs_comm[cmd]} tree-root 2> /dev/null)" && return 0
 return 1
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
index 995b2ad2d..31618d353 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
@@ -14,8 +14,8 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "use-simple" ; then
         bzrinfo[1]=${${bzrinfo[1]}%% *}
     fi
 else
-    bzrbase=${${(M)${(f)"$( bzr info )"}:# ##branch\ root:*}/*: ##/}
-    bzrinfo=( ${${${(M)${(f)"$( bzr version-info )"}:#(#s)(revno|branch-nick)*}/*: /}/*\//} )
+    bzrbase=${${(M)${(f)"$( ${vcs_comm[cmd]} info )"}:# ##branch\ root:*}/*: ##/}
+    bzrinfo=( ${${${(M)${(f)"$( ${vcs_comm[cmd]} version-info )"}:#(#s)(revno|branch-nick)*}/*: /}/*\//} )
     bzrbase="$(VCS_INFO_realpath ${bzrbase})"
 fi
 
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 0d8a4f915..23545e53c 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -55,7 +55,7 @@ VCS_INFO_git_getaction () {
 
 VCS_INFO_git_getbranch () {
     local gitbranch gitdir=$1
-    local gitsymref='git symbolic-ref HEAD'
+    local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD"
 
     if    [[ -d "${gitdir}/rebase-apply" ]] \
        || [[ -d "${gitdir}/rebase" ]]       \
@@ -77,7 +77,7 @@ VCS_INFO_git_getbranch () {
         gitbranch="$(${(z)gitsymref} 2> /dev/null)"
 
         if [[ $? -ne 0 ]] ; then
-            gitbranch="$(git describe --exact-match HEAD 2>/dev/null)"
+            gitbranch="$(${vcs_comm[cmd]} describe --exact-match HEAD 2>/dev/null)"
 
             if [[ $? -ne 0 ]] ; then
                 gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..."
@@ -98,7 +98,7 @@ fi
 
 VCS_INFO_adjust
 gitaction="$(VCS_INFO_git_getaction ${gitdir})"
-gitbase=${PWD%/${$( git rev-parse --show-prefix )%/##}}
+gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}}
 rrn=${gitbase:t}
 VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}"
 return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn
index 5974df87a..688c85eec 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn
@@ -7,6 +7,6 @@ local mtnbranch mtnbase
 
 mtnbase=${vcs_comm[basedir]}
 rrn=${mtnbase:t}
-mtnbranch=${${(M)${(f)"$( mtn status )"}:#(#s)Current branch:*}/*: /}
+mtnbranch=${${(M)${(f)"$( ${vcs_comm[cmd]} status )"}:#(#s)Current branch:*}/*: /}
 VCS_INFO_formats '' "${mtnbranch}" "${mtnbase}"
 return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
index 077306aa1..dccd9d340 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
@@ -7,7 +7,7 @@ setopt localoptions extendedglob
 local p4base a b
 local -A p4info
 
-p4 info | while IFS=: read a b; do p4info[${a// /_}]="${b## #}"; done
+${vcs_comm[cmd]} info | while IFS=: read a b; do p4info[${a// /_}]="${b## #}"; done
 p4base=${vcs_comm[basedir]}
 
 # We'll use the client name as the branch; close enough.
@@ -15,7 +15,7 @@ local p4branch change
 # We'll use the latest change number to which the hierarchy from
 # here down is synced as the revision.
 # I suppose the following might be slow on a tortuous client view.
-change="${${$(p4 changes -m 1 ...\#have)##Change }%% *}"
+change="${${$(${vcs_comm[cmd]} changes -m 1 ...\#have)##Change }%% *}"
 zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat p4branch ||
 p4branch="%b:%r"
 zformat -f p4branch "${p4branch}" "b:${p4info[Client_name]}" \
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
index 7a23419b0..57ff5d8a1 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -10,10 +10,10 @@ local -A svninfo parentinfo
 
 svnbase=".";
 svninfo=()
-svn info --non-interactive | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done
+${vcs_comm[cmd]} info --non-interactive | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done
 while [[ -d "${svnbase}/../.svn" ]]; do
     parentinfo=()
-    svn info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done
+    ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done
     [[ ${parentinfo[Repository_UUID]} != ${svninfo[Repository_UUID]} ]] && break
     svninfo=(${(kv)parentinfo})
     svnbase="${svnbase}/.."
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla
index e1921725f..cbc48c0a2 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla
@@ -8,6 +8,6 @@ local tlabase tlabranch
 tlabase="$(VCS_INFO_realpath ${vcs_comm[basedir]})"
 rrn=${tlabase:t}
 # tree-id gives us something like 'foo@example.com/demo--1.0--patch-4', so:
-tlabranch=${${"$( tla tree-id )"}/*\//}
+tlabranch=${${"$( ${vcs_comm[cmd]} tree-id )"}/*\//}
 VCS_INFO_formats '' "${tlabranch}" "${tlabase}"
 return 0
diff --git a/Functions/VCS_Info/VCS_INFO_check_com b/Functions/VCS_Info/VCS_INFO_check_com
index 6d65360d5..d9f7a1330 100644
--- a/Functions/VCS_Info/VCS_INFO_check_com
+++ b/Functions/VCS_Info/VCS_INFO_check_com
@@ -4,5 +4,12 @@
 
 setopt localoptions NO_shwordsplit
 
-(( ${+commands[$1]} )) && [[ -x ${commands[$1]} ]] && return 0
+case $1 in
+    (/*)
+        [[ -x $1 ]] && return 0
+        ;;
+    (*)
+        (( ${+commands[$1]} )) && [[ -x ${commands[$1]} ]] && return 0
+esac
+
 return 1
diff --git a/Functions/VCS_Info/VCS_INFO_get_cmd b/Functions/VCS_Info/VCS_INFO_get_cmd
new file mode 100644
index 000000000..26046f1c5
--- /dev/null
+++ b/Functions/VCS_Info/VCS_INFO_get_cmd
@@ -0,0 +1,6 @@
+## vim:ft=zsh
+# find out if the user wants us to use a special binary.
+# the default command name is the same as the backend name.
+local cmd
+zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" "command" cmd
+vcs_comm[cmd]=${cmd:-$vcs}
diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index fb87e6a54..7ecd1224a 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -17,6 +17,7 @@ static_functions=(
     VCS_INFO_bydir_detect
     VCS_INFO_check_com
     VCS_INFO_formats
+    VCS_INFO_get_cmd
     VCS_INFO_maxexports
     VCS_INFO_nvcsformats
     VCS_INFO_realpath
@@ -74,6 +75,7 @@ vcs_info () {
             continue
         fi
         vcs_comm=()
+        VCS_INFO_get_cmd
         VCS_INFO_detect_${vcs} && (( found = 1 )) && break
     done