about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2020-03-12 18:48:53 +0000
committerDaniel Shahaf <danielsh@apache.org>2020-03-15 00:18:25 +0000
commit8e128afb2c655d759d013c98002ef92795a5cafa (patch)
tree78d558ab0df149f7419d1f7b6b2baaef7e310cf8 /Functions
parentc756545014c93448494ee4f1d841d8487601a324 (diff)
downloadzsh-8e128afb2c655d759d013c98002ef92795a5cafa.tar.gz
zsh-8e128afb2c655d759d013c98002ef92795a5cafa.tar.xz
zsh-8e128afb2c655d759d013c98002ef92795a5cafa.zip
45547: vcs_info git: In interactive rebases, process gen-unapplied-string arguments like gen-applied-string arguments are processed.
I consider this a bugfix, since it's unexpected for -applied and
-unapplied to differ about this.
Diffstat (limited to 'Functions')
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git23
1 files changed, 16 insertions, 7 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index d8e5d1ff1..f7c4210e8 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -196,15 +196,16 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
     # 'git rebase -i'
     patchdir="${gitdir}/rebase-merge"
     local p
-    [[ -f "${patchdir}/done" ]] &&
-    for p in ${(f)"$(< "${patchdir}/done")"}; do
+    VCS_INFO_git_map_rebase_line_to_hash_and_subject() {
+        local p=$1
+        unset REPLY
         # pick/edit/fixup/squash/reword: Add "$hash $subject" to $git_patches_applied.
         # exec: Add "exec ${command}" to $git_patches_applied.
         # (anything else): As 'exec'.
         case $p in
             ([#]*)
                 # Comment line.  Skip.
-                continue
+                return 0
                 ;; 
             ((p|pick|e|edit|r|reword|f|fixup|s|squash)' '*)
                 # The line is of the form "pick $hash $subject".
@@ -241,11 +242,19 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
                     p+=" ?"
                 fi
         esac
-        git_patches_applied+=("$p")
-    done
+        REPLY=$p
+    }
+    if [[ -f "${patchdir}/done" ]] ; then
+        for p in ${(f)"$(< "${patchdir}/done")"}; do
+            VCS_INFO_git_map_rebase_line_to_hash_and_subject "$p"
+            (( $+REPLY )) && git_patches_applied+=( "$REPLY" )
+        done
+    fi
     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")"}}:#[#]*} )
+        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" )
+        done
     fi
     VCS_INFO_git_handle_patches
 elif [[ -d "${gitdir}/rebase-apply" ]]; then