summaryrefslogtreecommitdiff
path: root/Functions/VCS_Info/VCS_INFO_quilt
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
committerAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
commitb09f4483416c54c1782824633dfabaf2ec0265b6 (patch)
tree304bc82642862525ae680c7fbaa249663b10ad57 /Functions/VCS_Info/VCS_INFO_quilt
parent12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff)
parent6e55c920503071e917619b8cb1a188cd35d772db (diff)
downloadzsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz
zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip
New upstream version 5.8.1.2-test
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_quilt')
-rw-r--r--Functions/VCS_Info/VCS_INFO_quilt57
1 files changed, 33 insertions, 24 deletions
diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index fef85964a..ce5b41f24 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -92,7 +92,7 @@ function VCS_INFO_quilt-patch2subject() {
emulate -L zsh
setopt extendedglob
local mode="$1"
- local patches pc tmp qstring root
+ local patches pc qstring root
local -i ret
local context
local -a applied unapplied applied_string unapplied_string quiltcommand quilt_env
@@ -113,9 +113,12 @@ function VCS_INFO_quilt-patch2subject() {
;;
esac
- VCS_INFO_quilt-dirfind .pc .version
- ret=$? pc=$REPLY
- if (( ret == 0 )); then
+ # Look for the patches directory.
+ #
+ # 1. Check if there's a .pc/.version file in a parent dir. If so, use the
+ # patches dir from the corresponding .pc/.quilt_patches.
+ if VCS_INFO_quilt-dirfind .pc .version; then
+ pc=$REPLY
[[ ${quiltmode} == 'standalone' ]] && root=${pc}
pc=${pc}/.pc
if [[ -e ${pc}/applied-patches ]]; then
@@ -128,33 +131,35 @@ function VCS_INFO_quilt-patch2subject() {
fi
patches=$(<$pc/.quilt_patches)
patches=`builtin cd -q "${pc:h}" && print -r - ${patches:P}`
+ # 2. Else, locate a patches dir using the style settings.
+ else
+ zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}"
+ : ${patches:="patches"}
+ if [[ "${patches}" != /* ]]; then
+ if VCS_INFO_quilt-dirfind "${patches}"; then
+ patches=$REPLY/$patches
+ else
+ return $?
+ fi
+ else
+ [[ -d ${patches} ]] || return 1
+ fi
+ quilt_env+=(QUILT_PATCHES="$patches")
fi
+ # At this point, $patches is set and points to an existing directory.
+
if zstyle -t "${context}" get-unapplied; then
# This zstyle call needs to be moved further up if `quilt' needs
# to be run in more places than this one.
zstyle -s "${context}" quiltcommand quiltcommand || quiltcommand='quilt'
- quilt_env=(env)
- if [ -z "$patches" ]; then
- zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}"
- if [[ "${patches}" != /* ]]; then
- tmp=${patches:-patches}
- VCS_INFO_quilt-dirfind "${tmp}"
- ret=$? patches=$REPLY
- (( ret )) && return ${ret}
- patches=${patches}/${tmp}
- else
- [[ -d ${patches} ]] || return 1
- fi
- quilt_env+=(QUILT_PATCHES="$patches")
- fi
- unapplied=( ${(f)"$(${quilt_env[@]} $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
+ unapplied=( ${(f)"$(if (( $+quilt_env[1] )); then export ${quilt_env[@]}; fi
+ $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
unapplied=( ${unapplied:#} )
else
unapplied=()
fi
- if [[ -n $patches ]]; then
- () {
+ {
local i
for ((i=1; i<=$#applied; i++)); do
if VCS_INFO_quilt-patch2subject "$patches/$applied[$i]" && (( $+REPLY ))
@@ -172,13 +177,17 @@ function VCS_INFO_quilt-patch2subject() {
unapplied[$i]+=" ?"
fi
done
- }
- fi
+ }
+
+ typeset -A quilt_extra_info=(
+ quilt-patches-dir ${patches}
+ ${pc:+"quilt-pc-dir"} $pc
+ )
VCS_INFO_set-patch-format 'applied' 'applied_string' \
'unapplied' 'unapplied_string' \
${context} qstring \
- '' ''
+ quilt_extra_info '' quilt_extra_info
qstring=$REPLY
case ${mode} in