diff options
| author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2017-01-23 18:15:35 +0000 |
|---|---|---|
| committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2017-01-25 04:22:30 +0000 |
| commit | 0ea1957608a6b496fc244078ce9e24f00327aba9 (patch) | |
| tree | 860183613739ec834e774961f2fb0799ab690c9f /Functions/VCS_Info/VCS_INFO_set-patch-format | |
| parent | 40401: vcs_info git: Fix the %c patch-format expando. (diff) | |
| download | zsh-0ea1957608a6b496fc244078ce9e24f00327aba9.tar zsh-0ea1957608a6b496fc244078ce9e24f00327aba9.tar.gz zsh-0ea1957608a6b496fc244078ce9e24f00327aba9.tar.bz2 zsh-0ea1957608a6b496fc244078ce9e24f00327aba9.tar.lz zsh-0ea1957608a6b496fc244078ce9e24f00327aba9.tar.xz zsh-0ea1957608a6b496fc244078ce9e24f00327aba9.tar.zst zsh-0ea1957608a6b496fc244078ce9e24f00327aba9.zip | |
40403/0001: vcs_info set-patch-format helper: Part #1.
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_set-patch-format')
| -rw-r--r-- | Functions/VCS_Info/VCS_INFO_set-patch-format | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format new file mode 100644 index 000000000..310df9625 --- /dev/null +++ b/Functions/VCS_Info/VCS_INFO_set-patch-format @@ -0,0 +1,20 @@ +# This function is the common guts of the gen-applied-string / +# gen-unapplied-string / set-patch-format dance of several backends. +# +# Parameters: +# $1 - name of an array parameter to be the argument to gen-applied-string +# $2 - name of a parameter to store the applied-string in +{ + local REPLY + if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then + if (( ${(P)#1} )); then + REPLY=${(P)1[1]} + else + REPLY="" + fi + else + REPLY=${hook_com[applied-string]} + fi + : ${(P)2::=$REPLY} + hook_com=() +} |
