diff options
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_set-patch-format')
-rw-r--r-- | Functions/VCS_Info/VCS_INFO_set-patch-format | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format index 5534e4832..c5da36808 100644 --- a/Functions/VCS_Info/VCS_INFO_set-patch-format +++ b/Functions/VCS_Info/VCS_INFO_set-patch-format @@ -10,12 +10,14 @@ # $6 - name of a parameter to store a patch-format format string in # $7 - name of an assoc parameter with extra $hook_com key-value pairs for the # set-patch-format hook invocation, or '' for none +# $8 - name of an array parameter with extra arguments for the patch-format zformat call, or '' for empty +# +# The expanded patch-format string is returned in $REPLY. # # Output: # - $hook_com is overwritten and the keys 'applied', 'applied-n', # 'unapplied', 'unapplied-n', 'all-n' are set. { - local REPLY if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then if (( ${(P)#1} )); then REPLY=${(P)1[1]} @@ -51,4 +53,13 @@ ) hook_com[all-n]=$(( ${hook_com[applied-n]} + ${hook_com[unapplied-n]} )) hook_com+=( ${7:+"${(@kvP)7}"} ) + if VCS_INFO_hook 'set-patch-format' "${(P)6}"; then + zformat -f REPLY "${(P)6}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \ + "n:${hook_com[applied-n]}" "c:${hook_com[unapplied-n]}" \ + "a:${hook_com[all-n]}" \ + ${8:+"${(@P)8}"} + else + REPLY=${hook_com[patch-replace]} + fi + hook_com=() } |