mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-05-19 14:36:04 +02:00
49723: vcs_info quilt: Use quilt-patch-dir and ${QUILT_PATCHES} even when get-unapplied hasn't been set
This affects the post-quilt hook. Before this patch, if no patches have been applied and get-unapplied hasn't been set, the second argument to that hook would undergo null elision. The generation of patch subjects for the gen-applied-string, gen-unapplied-string, and set-patch-format hooks was unaffected since it was guarded by [[ -n $patches ]].
This commit is contained in:
parent
e52062170a
commit
ee5e3d0c9d
|
@ -1,5 +1,9 @@
|
||||||
2022-01-29 Daniel Shahaf <d.s@daniel.shahaf.name>
|
2022-01-29 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||||
|
|
||||||
|
* 49723: Functions/VCS_Info/VCS_INFO_quilt: vcs_info quilt:
|
||||||
|
Use quilt-patch-dir and ${QUILT_PATCHES} even when get-unapplied
|
||||||
|
hasn't been set
|
||||||
|
|
||||||
* 49722: Functions/VCS_Info/VCS_INFO_quilt: vcs_info quilt:
|
* 49722: Functions/VCS_Info/VCS_INFO_quilt: vcs_info quilt:
|
||||||
Refactor for readability. No functional change.
|
Refactor for readability. No functional change.
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,12 @@ function VCS_INFO_quilt-patch2subject() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
VCS_INFO_quilt-dirfind .pc .version
|
# Look for the patches directory.
|
||||||
ret=$? pc=$REPLY
|
#
|
||||||
if (( ret == 0 )); then
|
# 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}
|
[[ ${quiltmode} == 'standalone' ]] && root=${pc}
|
||||||
pc=${pc}/.pc
|
pc=${pc}/.pc
|
||||||
if [[ -e ${pc}/applied-patches ]]; then
|
if [[ -e ${pc}/applied-patches ]]; then
|
||||||
|
@ -128,25 +131,27 @@ function VCS_INFO_quilt-patch2subject() {
|
||||||
fi
|
fi
|
||||||
patches=$(<$pc/.quilt_patches)
|
patches=$(<$pc/.quilt_patches)
|
||||||
patches=`builtin cd -q "${pc:h}" && print -r - ${patches:P}`
|
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
|
fi
|
||||||
|
# At this point, $patches is set and points to an existing directory.
|
||||||
|
|
||||||
if zstyle -t "${context}" get-unapplied; then
|
if zstyle -t "${context}" get-unapplied; then
|
||||||
# This zstyle call needs to be moved further up if `quilt' needs
|
# This zstyle call needs to be moved further up if `quilt' needs
|
||||||
# to be run in more places than this one.
|
# to be run in more places than this one.
|
||||||
zstyle -s "${context}" quiltcommand quiltcommand || quiltcommand='quilt'
|
zstyle -s "${context}" quiltcommand quiltcommand || quiltcommand='quilt'
|
||||||
if [ -z "$patches" ]; then
|
|
||||||
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
|
|
||||||
unapplied=( ${(f)"$(if (( $+quilt_env[1] )); then export ${quilt_env[@]}; fi
|
unapplied=( ${(f)"$(if (( $+quilt_env[1] )); then export ${quilt_env[@]}; fi
|
||||||
$quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
|
$quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
|
||||||
unapplied=( ${unapplied:#} )
|
unapplied=( ${unapplied:#} )
|
||||||
|
@ -154,8 +159,7 @@ function VCS_INFO_quilt-patch2subject() {
|
||||||
unapplied=()
|
unapplied=()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $patches ]]; then
|
{
|
||||||
() {
|
|
||||||
local i
|
local i
|
||||||
for ((i=1; i<=$#applied; i++)); do
|
for ((i=1; i<=$#applied; i++)); do
|
||||||
if VCS_INFO_quilt-patch2subject "$patches/$applied[$i]" && (( $+REPLY ))
|
if VCS_INFO_quilt-patch2subject "$patches/$applied[$i]" && (( $+REPLY ))
|
||||||
|
@ -173,8 +177,7 @@ function VCS_INFO_quilt-patch2subject() {
|
||||||
unapplied[$i]+=" ?"
|
unapplied[$i]+=" ?"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
fi
|
|
||||||
|
|
||||||
VCS_INFO_set-patch-format 'applied' 'applied_string' \
|
VCS_INFO_set-patch-format 'applied' 'applied_string' \
|
||||||
'unapplied' 'unapplied_string' \
|
'unapplied' 'unapplied_string' \
|
||||||
|
|
Loading…
Reference in New Issue