1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-07 01:30:59 +02:00

47561 (the git and cvs parts) (compare 44919 + 44920): vcs_info internals: cvs, git: Set ${vcs_comm[basedir]} like all other backends do.

That doesn't affect anything, not even other vcs_info internals; it's
just for consistency across backends.
This commit is contained in:
Aleksandr Mezin 2021-03-29 15:53:44 +00:00 committed by Daniel Shahaf
parent 2ffd292833
commit fc82e8193b
5 changed files with 28 additions and 13 deletions

View file

@ -1,3 +1,13 @@
2021-03-29 Aleksandr Mezin <mezin.alexander@gmail.com>
* 47561 (the git and cvs parts) (compare 44919 + 44920):
Functions/VCS_Info/Backends/VCS_INFO_detect_cvs,
Functions/VCS_Info/Backends/VCS_INFO_detect_git,
Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs,
Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info
internals: cvs, git: Set ${vcs_comm[basedir]} like all other
backends do.
2021-03-29 dana <dana@dana.is> 2021-03-29 dana <dana@dana.is>
* 47737: Completion/Zsh/Command/_zstyle: Fix option completion * 47737: Completion/Zsh/Command/_zstyle: Fix option completion

View file

@ -7,5 +7,18 @@ setopt localoptions NO_shwordsplit
[[ $1 == '--flavours' ]] && return 1 [[ $1 == '--flavours' ]] && return 1
VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
[[ -d "./CVS" ]] && [[ -r "./CVS/Repository" ]] && return 0 if ! [[ -d "./CVS" ]] || ! [[ -r "./CVS/Repository" ]] ; then
return 1 return 1
fi
# Look for the most distant parent that still has a CVS subdirectory.
local cvsbase="."
cvsbase=${cvsbase:P}
while [[ -d "${cvsbase:h}/CVS" ]]; do
cvsbase="${cvsbase:h}"
if [[ $cvsbase == '/' ]]; then
break
fi
done
vcs_comm[basedir]="${cvsbase}"

View file

@ -7,6 +7,7 @@ setopt localoptions NO_shwordsplit
[[ $1 == '--flavours' ]] && { print -l git-p4 git-svn; return 0 } [[ $1 == '--flavours' ]] && { print -l git-p4 git-svn; return 0 }
if VCS_INFO_check_com ${vcs_comm[cmd]} && vcs_comm[gitdir]="$(${vcs_comm[cmd]} rev-parse --git-dir 2> /dev/null)" ; then if VCS_INFO_check_com ${vcs_comm[cmd]} && vcs_comm[gitdir]="$(${vcs_comm[cmd]} rev-parse --git-dir 2> /dev/null)" ; then
vcs_comm[basedir]="$( ${vcs_comm[cmd]} rev-parse --show-toplevel 2> /dev/null )"
if [[ -d ${vcs_comm[gitdir]}/svn ]] ; then vcs_comm[overwrite_name]='git-svn' 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 elif [[ -d ${vcs_comm[gitdir]}/refs/remotes/p4 ]] ; then vcs_comm[overwrite_name]='git-p4' ; fi
return 0 return 0

View file

@ -5,17 +5,8 @@
setopt localoptions NO_shwordsplit setopt localoptions NO_shwordsplit
local cvsbranch cvsbase local cvsbranch cvsbase
# Look for the most distant parent that still has a CVS subdirectory. cvsbase="${vcs_comm[basedir]}"
# VCS_INFO_detect_cvs ensured that ./CVS/Repository exists. # VCS_INFO_detect_cvs ensured that ./CVS/Repository exists.
cvsbase="."
cvsbase=${cvsbase:P}
while [[ -d "${cvsbase:h}/CVS" ]]; do
cvsbase="${cvsbase:h}"
if [[ $cvsbase == '/' ]]; then
break
fi
done
cvsbranch=$(< ./CVS/Repository) cvsbranch=$(< ./CVS/Repository)
rrn=${cvsbase:t} rrn=${cvsbase:t}
cvsbranch=${cvsbranch##${rrn}/} cvsbranch=${cvsbranch##${rrn}/}

View file

@ -138,7 +138,7 @@ VCS_INFO_git_handle_patches () {
gitdir=${vcs_comm[gitdir]} gitdir=${vcs_comm[gitdir]}
VCS_INFO_git_getbranch ${gitdir} VCS_INFO_git_getbranch ${gitdir}
gitbase=$( ${vcs_comm[cmd]} rev-parse --show-toplevel 2> /dev/null ) gitbase=${vcs_comm[basedir]}
if [[ -z ${gitbase} ]]; then if [[ -z ${gitbase} ]]; then
# Bare repository # Bare repository
gitbase=${gitdir:P} gitbase=${gitdir:P}