Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] vcs_info git: Check the get-unapplied style as documented (was: [PATCH v3] Updated StGit patch detection in vcs_info)



The style was treated as "always true" rather than as "settable, false
by default" in the rebase-merge and cherry-pick cases.  This affects the
gen-unapplied-string hook, and may also affect gen-applied-string and
set-patch-format hooks if they accessed VCS_INFO_get_data_git's internal
parameters directly.

If this affects you, just set the style in your zshrc:
.
    zstyle ':vcs_info:git*:*:*' get-unapplied true

---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Daniel Shahaf wrote on Thu, Dec 08, 2022 at 22:06:40 +0000:
> Noticed two issues while there:
> 
> 1. (preëxisting) Some of the other codepaths don't check the
> get-unapplied style.  I'll send a patch for that in a minute.

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 23d4d31a1..37cd048db 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -244,7 +244,9 @@ if [[ -d "${gitdir}/rebase-merge" ]]; then
             (( $+REPLY )) && git_patches_applied+=( "$REPLY" )
         done
     fi
-    if [[ -f "${patchdir}/git-rebase-todo" ]] ; then
+    if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-unapplied &&
+       [[ -f "${patchdir}/git-rebase-todo" ]]
+    then
         for p in ${(f)"$(< "${patchdir}/git-rebase-todo")"}; do
             VCS_INFO_git_map_rebase_line_to_hash_and_subject "$p"
             (( $+REPLY )) && git_patches_unapplied+=( "$REPLY" )
@@ -374,7 +376,9 @@ elif [[ -f "${gitdir}/CHERRY_PICK_HEAD" ]]; then
     # TODO: maybe read up to the first blank line
     IFS='' read -r subject < "${gitdir}/MERGE_MSG"
     git_patches_applied=( "$(<${gitdir}/CHERRY_PICK_HEAD) ${subject}" )
-    if [[ -f "${gitdir}/sequencer/todo" ]]; then
+    if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-unapplied &&
+       [[ -f "${gitdir}/sequencer/todo" ]]
+    then
         # Get the next patches, and remove the one that's in CHERRY_PICK_HEAD.
         git_patches_unapplied=( ${${(M)${(f)"$(<"${gitdir}/sequencer/todo")"}:#pick *}#pick } )
         git_patches_unapplied[1]=()




Messages sorted by: Reverse Date, Date, Thread, Author