about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2018-10-02 15:20:52 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2018-10-07 15:05:15 +0000
commita27fad1ae2c87bdb4861005719fd7db86827344c (patch)
tree959b3511c112d6f5209c2882e28addfff06bb3f7 /Functions
parentabc94e8f6aa8367ce9d6e972d55f8e7d34fb08ec (diff)
downloadzsh-a27fad1ae2c87bdb4861005719fd7db86827344c.tar.gz
zsh-a27fad1ae2c87bdb4861005719fd7db86827344c.tar.xz
zsh-a27fad1ae2c87bdb4861005719fd7db86827344c.zip
43586: vcs_info git: Reformat to minimise next diff. No functional change.
Diffstat (limited to 'Functions')
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git15
1 files 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 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