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

[PATCH 1/3] vcs_info git: Reformat to minimise next diff. No functional change.



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

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index c3e62db3a..af7466be5 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -190,8 +190,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



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