commit 8e7f84ddda81280812a5082ff82209c30928b17e
Author: Alexandre Rames <alexandre.rames@xxxxxxx>
Date:   Thu Sep 4 15:21:39 2014 +0100
    Add completion for stgit `--patch` option.
diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit
index b2f2aea..6248267 100644
--- a/Completion/Unix/Command/_stgit
+++ b/Completion/Unix/Command/_stgit
@@ -32,6 +32,17 @@ else
 	compadd $(stg series --noprefix 2> /dev/null) \
 		&& ret=0
     ;;
+    (ref*)
+      last_word="$words[$CURRENT-1]"
+      refresh_patch_options=( -p --patch )
+      if [[ -n ${refresh_patch_options[(r)$last_word]} ]]; then
+	_wanted -V "applied patches" expl "patch" \
+	  compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \
+		  && ret=0
+      else
+	_files
+      fi
+    ;;
     (*)
       _files
     ;;