From f9952301b2e4ba1c2181beabc02a7e0597358e7b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 2 Oct 2018 15:21:53 +0000 Subject: unposted: Indicate which use-case each branch handles. --- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Functions') diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index c3e62db3a..05de4ae84 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -183,6 +183,7 @@ then git_patches_unapplied=(${(f)"$(< "${patchdir}/unapplied")"}) VCS_INFO_git_handle_patches elif [[ -d "${gitdir}/rebase-merge" ]]; then + # 'git rebase -i' patchdir="${gitdir}/rebase-merge" local p [[ -f "${patchdir}/done" ]] && @@ -199,12 +200,13 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then fi VCS_INFO_git_handle_patches elif [[ -d "${gitdir}/rebase-apply" ]]; then - # Fake patch names for all but current patch + # 'git rebase' without -i patchdir="${gitdir}/rebase-apply" local next="${patchdir}/next" if [[ -f $next ]]; then local cur=$(< $next) local p subject + # Fake patch names for all but current patch for ((p = 1; p < cur; p++)); do printf -v "git_patches_applied[$p]" "%04d ?" "$p" done -- cgit v1.2.3 From abc94e8f6aa8367ce9d6e972d55f8e7d34fb08ec Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 30 Sep 2018 22:16:08 +0000 Subject: 43585: vcs_info svn: Recognize working copies in need of an upgrade. --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_svn | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index ece6efdad..936b76a6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-10-07 Daniel Shahaf + + * 43585: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn: + vcs_info svn: Recognize working copies in need of an upgrade. + 2018-10-03 Peter Stephenson * unposted: Etc/FAQ.yo: minor typos. diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn index a773a727d..c1547950f 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn @@ -9,6 +9,7 @@ local svnbase svnbranch a b rrn local -i rc local -A svninfo parentinfo cwdinfo local -A hook_com +integer -r SVN_ERR_WC_UPGRADE_REQUIRED=155036 # from /usr/local/include/subversion-1/svn_error_codes.h svnbase="."; svninfo=() @@ -18,7 +19,15 @@ svninfo=() local -a dat dat=( ${(f)"$(${vcs_comm[cmd]} info --non-interactive 2>&1)"} ) rc=$? -(( rc != 0 )) && return 1 +if (( rc != 0 )) ; then + if (( rc == 1 )) && [[ -n ${(M)dat:#"svn: E${SVN_ERR_WC_UPGRADE_REQUIRED}: "*} ]]; then + hook_com=() + VCS_INFO_formats '' '?' '?' '' '' '?' 'upgrade required' + return $? + else + return 1 + fi +fi # The following line is the real code, the following is the workaround. #${vcs_comm[cmd]} info --non-interactive \ print -l "${dat[@]}" \ -- cgit v1.2.3 From a27fad1ae2c87bdb4861005719fd7db86827344c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 2 Oct 2018 15:20:52 +0000 Subject: 43586: vcs_info git: Reformat to minimise next diff. No functional change. --- ChangeLog | 4 ++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 936b76a6f..0191b3164 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018-10-07 Daniel Shahaf + * 43586: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: Reformat to minimise next diff. No functional + change. + * 43585: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn: vcs_info svn: Recognize working copies in need of an upgrade. diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 05de4ae84..892b4741f 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -191,8 +191,19 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then # pick/edit/fixup/squash/reword: Add "$hash $subject" to $git_patches_applied. # exec: Add "exec ${command}" to $git_patches_applied. # (anything else): As 'exec'. - p=${p/(#s)(p|pick|e|edit|r|reword|f|fixup|s|squash) /} - p=${p/(#s)x /exec } + case $p in + ((p|pick|e|edit|r|reword|f|fixup|s|squash)' '*) + # The line is of the form "pick $hash $subject". + # Just strip the verb and we're good to go. + p=${p#* } + ;; + (x *) + # The line is of the form 'exec foo bar baz' where 'foo bar + # baz' is a shell command. There's no way to map _that_ to + # "$hash $subject", but I hope this counts as making an effort. + p=${p/x /exec } + ;; + esac git_patches_applied+=("$p") done if [[ -f "${patchdir}/git-rebase-todo" ]] ; then -- cgit v1.2.3 From 0c00eed4c77aee7af64e9272bfd1cddb8663e477 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 2 Oct 2018 15:20:53 +0000 Subject: 43588: vcs_info git: Make sure applied-patches is of the form "$hash $subject" --- that is, has a space and a non-empty second argument --- even with future 'git rebase -i' verbs. Use of '?' is consistent with these precedents: Backends/VCS_INFO_get_data_git:220: printf -v "git_patches_applied[$p]" "%04d ?" "$p" Backends/VCS_INFO_get_data_git:242: git_patches_applied+=("? $subject") Backends/VCS_INFO_get_data_git:244: git_patches_applied+=("?") VCS_INFO_quilt:160: applied[$i]+=" ?" VCS_INFO_quilt:168: unapplied[$i]+=" ?" --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 0191b3164..f6d0af294 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2018-10-07 Daniel Shahaf + * 43588: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: Make sure applied-patches is of the form "$hash + $subject" --- that is, has a space and a non-empty second + argument --- even with future 'git rebase -i' verbs. + * 43586: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git: Reformat to minimise next diff. No functional change. diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 892b4741f..087a8a283 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -203,6 +203,11 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then # "$hash $subject", but I hope this counts as making an effort. p=${p/x /exec } ;; + (*) + # Forward compatibility with not-yet-existing 'git rebase -i' verbs. + if [[ $p != *\ * ]]; then + p+=" ?" + fi esac git_patches_applied+=("$p") done -- cgit v1.2.3 From 5c9ef1a1faf42136ce330aa6f8e2123e83497239 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 2 Oct 2018 15:20:54 +0000 Subject: 43587: vcs_info git: In 'git rebase -i', when computing subjects of applied-patches, handle an edge case where the subject is not available. --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index f6d0af294..af9107e62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2018-10-07 Daniel Shahaf + * 43587: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: In 'git rebase -i', when computing subjects + of applied-patches, handle an edge case where the subject is + not available. + * 43588: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git: Make sure applied-patches is of the form "$hash $subject" --- that is, has a space and a non-empty second diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 087a8a283..04d15bb4a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -196,6 +196,24 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then # The line is of the form "pick $hash $subject". # Just strip the verb and we're good to go. p=${p#* } + # Special case: in an interactive rebase, if the user wrote "p $shorthash\n" + # in the editor (without a description after the hash), then the .../done + # file will contain "p $longhash $shorthash\n" (git 2.11.0) or "pick $longhash\n" + # (git 2.19.0). + if [[ $p != *\ * ]]; then + # The line is of the form "pick $longhash\n" + # + # Mark the log message subject as unknown. + # TODO: Can we performantly obtain the subject? + p+=" ?" + elif (( ${#${p//[^ ]}} == 1 )) && [[ ${p%% *} == ${p#* }* ]]; then + # The line is of the form "p $longhash $shorthash\n" + # + # The shorthash is superfluous, so discard it, and mark + # the log message subject as unknown. + # TODO: Can we performantly obtain the subject? + p="${p%% *} ?" + fi ;; (x *) # The line is of the form 'exec foo bar baz' where 'foo bar @@ -212,6 +230,7 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then git_patches_applied+=("$p") done if [[ -f "${patchdir}/git-rebase-todo" ]] ; then + # TODO: Process ${patchdir}/git-rebase-todo lines like ${patchdir}/done lines are git_patches_unapplied=( ${${(f)${"$(<"${patchdir}/git-rebase-todo")"}}:#[#]*} ) fi VCS_INFO_git_handle_patches -- cgit v1.2.3 From a05533e425ebb36044680f403666dab7bc26a075 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 7 Oct 2018 17:46:40 +0000 Subject: 43618: vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function. This allows enabling tracing of the helper functions without fned'ing the outer function. --- ChangeLog | 9 +++++++++ Functions/VCS_Info/Backends/VCS_INFO_detect_p4 | 2 ++ Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr | 3 +++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 3 +++ Functions/VCS_Info/VCS_INFO_quilt | 7 +++++-- 5 files changed, 22 insertions(+), 2 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index fa50664fb..727d19f00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-10-08 Daniel Shahaf + + * 43618: Functions/VCS_Info/Backends/VCS_INFO_detect_p4, + Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr, + Functions/VCS_Info/Backends/VCS_INFO_get_data_git, + Functions/VCS_Info/VCS_INFO_quilt: vcs_info: Don't redefine + helper functions on every execution of the autoloadable outer + function. + 2018-10-08 Peter Stephenson * unposted: tweak to Doc/Zsh/builtins.yo to put close diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 index 95a534786..d171c68ee 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 +++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 @@ -16,6 +16,7 @@ # of having such files in all client root directories and nowhere above. +(( ${+functions[VCS_INFO_p4_get_server]} )) || VCS_INFO_p4_get_server() { emulate -L zsh setopt extendedglob @@ -43,6 +44,7 @@ VCS_INFO_p4_get_server() { } +(( ${+functions[VCS_INFO_detect_p4]} )) || VCS_INFO_detect_p4() { local serverport p4where diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr index 705db65a7..b30e0e12b 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr @@ -8,6 +8,7 @@ local bzrbase bzrbr bzr_changes bzr_type local -a bzrinfo local -A hook_com bzr_info +(( ${+functions[VCS_INFO_bzr_get_info]} )) || VCS_INFO_bzr_get_info() { bzrinfo=( ${(s.:.)$( ${vcs_comm[cmd]} version-info --custom \ --template="{revno}:{branch_nick}:{clean}")} ) @@ -20,6 +21,7 @@ VCS_INFO_bzr_get_info() { fi } +(( ${+functions[VCS_INFO_bzr_get_info_restricted]} )) || VCS_INFO_bzr_get_info_restricted() { # we are forbidden from fetching info on bound branch from remote repository bzrinfo=( $(${vcs_comm[cmd]} revno) ${bzrbase:t} ) @@ -30,6 +32,7 @@ VCS_INFO_bzr_get_info_restricted() { fi } +(( ${+functions[VCS_INFO_bzr_get_changes]} )) || VCS_INFO_bzr_get_changes() { local -A counts local line flag diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 04d15bb4a..0050f613a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -8,6 +8,7 @@ local -i querystaged queryunstaged local -a git_patches_applied git_patches_unapplied local -A hook_com +(( ${+functions[VCS_INFO_git_getaction]} )) || VCS_INFO_git_getaction () { local gitdir=$1 local tmp @@ -70,6 +71,7 @@ VCS_INFO_git_getaction () { return 1 } +(( ${+functions[VCS_INFO_git_getbranch]} )) || VCS_INFO_git_getbranch () { local gitdir=$1 tmp actiondir local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD" @@ -118,6 +120,7 @@ VCS_INFO_git_getbranch () { return 0 } +(( ${+functions[VCS_INFO_git_handle_patches]} )) || VCS_INFO_git_handle_patches () { local git_applied_s git_unapplied_s gitmsg git_patches_applied=(${(Oa)git_patches_applied}) diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt index 381b58489..1f20e895d 100644 --- a/Functions/VCS_Info/VCS_INFO_quilt +++ b/Functions/VCS_Info/VCS_INFO_quilt @@ -1,5 +1,6 @@ ## vim:ft=zsh:foldmethod=marker +(( ${+functions[VCS_INFO_quilt-match]} )) || function VCS_INFO_quilt-match() { emulate -L zsh setopt extendedglob @@ -20,6 +21,7 @@ function VCS_INFO_quilt-match() { return 1 } +(( ${+functions[VCS_INFO_quilt-standalone-detect]} )) || function VCS_INFO_quilt-standalone-detect() { emulate -L zsh setopt extendedglob @@ -58,6 +60,7 @@ function VCS_INFO_quilt-standalone-detect() { return 1 } +(( ${+functions[VCS_INFO_quilt-dirfind]} )) || function VCS_INFO_quilt-dirfind() { # This is a wrapper around VCS_INFO_bydir_detect(). It makes sure # that $vcs_comm[] is unchanged. Currently, changing anything in it @@ -80,11 +83,12 @@ function VCS_INFO_quilt-dirfind() { return ${ret} } +(( ${+functions[VCS_INFO_quilt-patch2subject]} )) || function VCS_INFO_quilt-patch2subject() { VCS_INFO_patch2subject "$@" } -function VCS_INFO_quilt() { +{ emulate -L zsh setopt extendedglob local mode="$1" @@ -192,4 +196,3 @@ function VCS_INFO_quilt() { VCS_INFO_hook 'post-quilt' ${mode} ${patches} ${pc:-\\-nopc-} } -VCS_INFO_quilt "$@" -- cgit v1.2.3 From 0e0219118d2df43ee52d44ef5ca93354597d5508 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 7 Oct 2018 17:46:41 +0000 Subject: 43619: vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', never just 'foo'. --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 13 +++---------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 727d19f00..27052b0cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2018-10-08 Daniel Shahaf + * 43619: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: In non-interactive rebases, always set + $hook_com[git_patches_applied] to a string of the form 'foo bar', + never just 'foo'. + * 43618: Functions/VCS_Info/Backends/VCS_INFO_detect_p4, Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr, Functions/VCS_Info/Backends/VCS_INFO_get_data_git, diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 0050f613a..cd57902b6 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -260,18 +260,11 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then subject=$REPLY } fi + subject=${subject:-'?'} if [[ -f "${patchdir}/original-commit" ]]; then - if [[ -n $subject ]]; then - git_patches_applied+=("$(< ${patchdir}/original-commit) $subject") - else - git_patches_applied+=("$(< ${patchdir}/original-commit)") - fi + git_patches_applied+=("$(< ${patchdir}/original-commit) $subject") else - if [[ -n $subject ]]; then - git_patches_applied+=("? $subject") - else - git_patches_applied+=("?") - fi + git_patches_applied+=("? $subject") fi local last="$(< "${patchdir}/last")" if (( cur+1 <= last )); then -- cgit v1.2.3 From 31dcba76f07030f1a3c9f9ad6c41dbaf842eeb1a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 7 Oct 2018 17:46:42 +0000 Subject: 43617: vcs_info git: During a non-interactive rebase of a detached head, computer the %b expando correctly. Before this commit, the value of %b was the hash of the commit from the "source" side of the rebase, from .git/rebase-apply/orig-head and .git/rebase-apply/original-commit. This broke the invariant that %b expands to a git-rev-parse(1) expression resolving to what %r expands to. Use .git/rebase-apply/onto instead as, empirically, it contains the correct value. --- ChangeLog | 4 ++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 27052b0cd..cd79613f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018-10-08 Daniel Shahaf + * 43617: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: During a non-interactive rebase of a detached head, + computer the %b expando correctly. + * 43619: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index cd57902b6..8305cf41a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -90,7 +90,7 @@ VCS_INFO_git_getbranch () { [[ -z ${gitbranch} ]] && [[ -r ${actiondir}/head-name ]] \ && gitbranch="$(< ${actiondir}/head-name)" [[ -z ${gitbranch} || ${gitbranch} == 'detached HEAD' ]] \ - && gitbranch="$(< ${gitdir}/ORIG_HEAD)" + && gitbranch="$(< ${actiondir}/onto)" elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then gitbranch="$(${(z)gitsymref} 2> /dev/null)" -- cgit v1.2.3 From e38f15f8ff23651a8c4ef9fc394de7be93eb620f Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 7 Oct 2018 17:46:43 +0000 Subject: 43620 (tweaked): vcs_info git: Reverse the order patches are passed to gen-unapplied-string in. This is an incompatible change; see README for details. Tweaks (relative to posted version): tweaked README, removed scalpel (debug print). --- ChangeLog | 6 ++++++ Doc/Zsh/contrib.yo | 2 +- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 3 ++- Functions/VCS_Info/VCS_INFO_set-patch-format | 2 ++ README | 16 +++++++++++++++- 5 files changed, 26 insertions(+), 3 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index cd79613f3..c2f645bcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2018-10-08 Daniel Shahaf + * 43620 (tweaked): Doc/Zsh/contrib.yo, + Functions/VCS_Info/Backends/VCS_INFO_get_data_git, + Functions/VCS_Info/VCS_INFO_set-patch-format, README: vcs_info + git: Reverse the order patches are passed to gen-unapplied-string + in. + * 43617: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git: During a non-interactive rebase of a detached head, computer the %b expando correctly. diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 9e4e6bc8f..d32ba018d 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -1668,7 +1668,7 @@ tt(mq)) backend and in tt(quilt) support when the tt(unapplied-string) is generated; the tt(get-unapplied) style must be true. This hook gets the names of all unapplied patches which tt(vcs_info) -collected so far in the opposite order, which means that the first argument is +collected so far in order, which means that the first argument is the patch next-in-line to be applied and so forth. When setting tt(ret) to non-zero, the string in diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 8305cf41a..7ae2c0b27 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -123,8 +123,9 @@ VCS_INFO_git_getbranch () { (( ${+functions[VCS_INFO_git_handle_patches]} )) || VCS_INFO_git_handle_patches () { local git_applied_s git_unapplied_s gitmsg + # All callers populate $git_patches_applied and $git_patches_unapplied in + # order, but the hook requires us to reverse $git_patches_applied. git_patches_applied=(${(Oa)git_patches_applied}) - git_patches_unapplied=(${(Oa)git_patches_unapplied}) VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s' \ 'git_patches_unapplied' 'git_unapplied_s' \ diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format index cdf2d303e..917ebf6bf 100644 --- a/Functions/VCS_Info/VCS_INFO_set-patch-format +++ b/Functions/VCS_Info/VCS_INFO_set-patch-format @@ -3,8 +3,10 @@ # # Parameters: # $1 - name of an array parameter to be the argument to gen-applied-string +# (patches in reverse order) # $2 - name of a parameter to store the applied-string in # $3 - name of an array parameter to be the argument to gen-unapplied-string +# (patches in order) # $4 - name of a parameter to store the unapplied-string in # $5 - context argument for use in zstyle getters # $6 - name of a parameter to store a patch-format format string in diff --git a/README b/README index c792d4075..1583002a7 100644 --- a/README +++ b/README @@ -10,7 +10,7 @@ This is version 5.6.2 of the shell. This is a bugfix release, following release. Note in particular the changes highlighted under "Incompatibilities since -5.5.1" below. See NEWS for more information. +5.6.2" below. See NEWS for more information. Installing Zsh -------------- @@ -31,6 +31,20 @@ Zsh is a shell with lots of features. For a list of some of these, see the file FEATURES, and for the latest changes see NEWS. For more details, see the documentation. +Incompatibilities since 5.6.2 +----------------------------- + +1) vcs_info git: The gen-unapplied-string hook receives the patches in order (next +to be applied first). This is consistent with the hg backend and with one of +two contradictory claims in the documentation (the other one has been corrected). +In zsh through 5.6.2, the patches were passed in reverse order, next to be +applied being last in the array. + +The gen-applied-string hook is unaffected; it still receives the patches in +reverse order, from last applied to first applied. + +2) + Incompatibilities since 5.5.1 ----------------------------- -- cgit v1.2.3 From f6adb79ba5b30719cbe11992a263145a265fedd2 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 12 Oct 2018 13:40:36 +0000 Subject: 43685: add-zle-hook-widget: Support running under NO_UNSET ('set -u'). --- ChangeLog | 5 +++++ Functions/Misc/add-zle-hook-widget | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 531edbcf0..deb9aa9b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-10-14 Daniel Shahaf + + * 43685: Functions/Misc/add-zle-hook-widget: Support running + under NO_UNSET ('set -u'). + 2018-10-12 Peter Stephenson * 43674: Src/zsh.h, Config/version.mk: Split more parameter and diff --git a/Functions/Misc/add-zle-hook-widget b/Functions/Misc/add-zle-hook-widget index d8a3950fb..9cc35496f 100644 --- a/Functions/Misc/add-zle-hook-widget +++ b/Functions/Misc/add-zle-hook-widget @@ -129,7 +129,7 @@ function add-zle-hook-widget { else # Check whether attempting to add a widget named for the hook if [[ "$fn" = "$hook" ]]; then - if [[ -n "${widgets[$fn]}" ]]; then + if (( ${+widgets[$fn]} )); then print -u2 "$funcstack[1]: Cannot hook $fn to itself" return 1 fi @@ -141,8 +141,8 @@ function add-zle-hook-widget { integer i=${#options[ksharrays]}-2 zstyle -g extant_hooks "$hook" widgets # Check for an existing widget, add it as the first hook - if [[ ${widgets[$hook]} != "user:azhw:$hook" ]]; then - if [[ -n ${widgets[$hook]} ]]; then + if [[ ${widgets[$hook]:-} != "user:azhw:$hook" ]]; then + if [[ -n ${widgets[$hook]:-} ]]; then zle -A "$hook" "${widgets[$hook]}" extant_hooks=(0:"${widgets[$hook]}" "${extant_hooks[@]}") fi @@ -152,17 +152,17 @@ function add-zle-hook-widget { if [[ -z ${(M)extant_hooks[@]:#(<->:|)$fn} ]]; then # no index and not already hooked # assign largest existing index plus 1 - i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]}+1 + i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]:-0}+1 else return 0 fi extant_hooks+=("${i}:${fn}") zstyle -- "$hook" widgets "${extant_hooks[@]}" - if [[ -z "${widgets[$fn]}" ]]; then + if (( ! ${+widgets[$fn]} )); then autoload "${autoopts[@]}" -- "$fn" zle -N -- "$fn" fi - if [[ -z "${widgets[$hook]}" ]]; then + if (( ! ${+widgets[$hook]} )); then zle -N "$hook" azhw:"$hook" fi fi -- cgit v1.2.3 From fc3826190a6480d8e45e05e22ca64c548e79e36a Mon Sep 17 00:00:00 2001 From: Joey Pabalinas Date: Tue, 6 Nov 2018 13:34:10 -1000 Subject: 43779 (tweaked): add parentheses to fix expression with cprecedences option set --- ChangeLog | 3 +++ Functions/Zle/select-bracketed | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 41a2f7aa9..72a74849e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-11-08 Oliver Kiddle + * 43779 (tweaked): Joey Pabalinas: Functions/Zle/select-bracketed: + add parentheses to fix expression with cprecedences option set + * 43805: Src/Modules/nearcolor.c, Src/prompt.c: make nearcolor module use the default colour rather than black as a fallback diff --git a/Functions/Zle/select-bracketed b/Functions/Zle/select-bracketed index d467bb804..0cb4d0e76 100644 --- a/Functions/Zle/select-bracketed +++ b/Functions/Zle/select-bracketed @@ -17,8 +17,8 @@ setopt localoptions noksharrays local style=${${1:-$KEYS}[1]} matching="(){}[]<>bbBB" local -i find=${NUMERIC:-1} idx=${matching[(I)[${${1:-$KEYS}[2]}]]}%9 (( idx )) || return 1 # no corresponding closing bracket -local lmatch=${matching[1 + (idx-1) & ~1]} -local rmatch=${matching[1 + (idx-1) | 1]} +local lmatch=${matching[1 + ((idx-1) & ~1)]} +local rmatch=${matching[1 + ((idx-1) | 1)]} local -i start=CURSOR+1 end=CURSOR+1 rfind=find [[ $BUFFER[start] = "$rmatch" ]] && (( start--, end-- )) -- cgit v1.2.3 From 23154e46e6864f35c1fc2e052c4ea14fb42014fb Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 9 Dec 2018 19:41:19 +0000 Subject: 43879: vcs_info git: Fix fatal error in VCS_INFO_git_getbranch in corner case Before this commit, the following use-case: git checkout foo^ git show foo | git am would result in a fatal error, with vcs_info_msg_N_ not set: VCS_INFO_git_getbranch:18: no such file or directory: .git/rebase-apply/onto Now they are set correctly, and HEAD's commit hash is used. --- ChangeLog | 6 ++++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 129a38e80..e2508d6d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-12-13 Daniel Shahaf + + * 43879: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: Fix fatal error in VCS_INFO_git_getbranch in + corner case + 2018-12-09 dana * 43871: Completion/Unix/Type/_files: Support `-F '(pat ...)'` as diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 7ae2c0b27..ceb4f978a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -89,7 +89,7 @@ VCS_INFO_git_getbranch () { gitbranch="$(${(z)gitsymref} 2> /dev/null)" [[ -z ${gitbranch} ]] && [[ -r ${actiondir}/head-name ]] \ && gitbranch="$(< ${actiondir}/head-name)" - [[ -z ${gitbranch} || ${gitbranch} == 'detached HEAD' ]] \ + [[ -z ${gitbranch} || ${gitbranch} == 'detached HEAD' ]] && [[ -r ${actiondir}/onto ]] \ && gitbranch="$(< ${actiondir}/onto)" elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then @@ -112,9 +112,11 @@ VCS_INFO_git_getbranch () { ## Commented out because we don't know of a case in which 'describe --contains' fails and 'name-rev --tags' succeeds. #elif gitbranch="$(${vcs_comm[cmd]} name-rev --name-only --no-undefined --tags HEAD 2>/dev/null)" ; then elif gitbranch="$(${vcs_comm[cmd]} name-rev --name-only --no-undefined --always HEAD 2>/dev/null)" ; then - elif gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..." ; then - else - # Can't happen + fi + + if [[ -z ${gitbranch} ]] + then + gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..." fi return 0 -- cgit v1.2.3 From b6169745c1318a0405364a5d98618f25845d5209 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 19 Dec 2018 09:54:26 +0000 Subject: unposted, c.f. 43913: emulate -L zsh in edit-command-line Otherwise bad effects observed with GLOB_SUBST set. --- ChangeLog | 5 +++++ Functions/Zle/edit-command-line | 2 ++ 2 files changed, 7 insertions(+) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index bf954918e..4f3c3e0eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-12-19 Peter Stephenson + + * unposted c.f. 43913: Functions/Zle/edit-command-line: emulate + -L zsh to avoid bad effects with globsubst. + 2018-12-17 dana * 43897: Completion/Darwin/Command/_xcode-select, diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line index e17893e93..991775ea5 100644 --- a/Functions/Zle/edit-command-line +++ b/Functions/Zle/edit-command-line @@ -6,6 +6,8 @@ # will give ksh-like behaviour for that key, # except that it will handle multi-line buffers properly. +emulate -L zsh + () { exec