]> git.rmz.io Git - dotfiles.git/blobdiff - zsh/lib/prompt.zsh
zsh: fix git prompt
[dotfiles.git] / zsh / lib / prompt.zsh
index 61f5db8f64a3b387df4d0a1a11ee1104927c0903..3fc1c242758929cad8afc61f46eec3877ec8f751 100644 (file)
@@ -41,9 +41,9 @@ git_prompt_status() {
   # Get current status.
   while IFS=$'\n' read line; do
     if [[ "$line" == \#\#\ * ]]; then
-      [[ "$line" =~ '## ([^.]*)\.\.\.(.*)' ]] && branch=$match[1]
-      [[ "$line" =~ 'ahead ([0-9]+)'  ]]      && ahead=$match[1]
-      [[ "$line" =~ 'behind ([0-9]+)'  ]]     && behind=$match[1]
+      [[ "$line" =~ '## (.*?)(\.\.\.|$)' ]] && branch=$match[1]
+      [[ "$line" =~ 'ahead ([0-9]+)'  ]]  && ahead=$match[1]
+      [[ "$line" =~ 'behind ([0-9]+)'  ]] && behind=$match[1]
     else
       # Count added, deleted, modified, renamed, unmerged, untracked, dirty.
       # T (type change) is undocumented, see http://git.io/FnpMGw.