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

PATCH: _quilt: fix push and pop completion



Patch fixes 'bug' in _quilt completion script when there is not possible
to do push or pop. Also tabs are replaced with spaces because they were
not consistent.

Signed-off-by: Luka Perkov < lists ->-to->- lukaperkov.net >
---

diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt
index a2fd799..d12a672 100644
--- a/Completion/Unix/Command/_quilt
+++ b/Completion/Unix/Command/_quilt
@@ -14,17 +14,23 @@ case "$state" in
 
   case "$words[1]" in
       (applied|delete|files|graph|header|next|previous|refresh|unapplied)
-      	_wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"}
-	;;
+        _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"}
+        ;;
       (push)
-    	_wanted -V 'unapplied patches' expl 'patch' compadd ${(f)"$(quilt unapplied)"}
-    	;;
+        tmp=$(quilt unapplied 2>&1)
+        if [[ "$tmp[1,40]" != "File series fully applied, ends at patch" ]]; then
+          _wanted -V 'unapplied patches' expl 'patch' compadd ${(f)"$(quilt unapplied)"}
+        fi
+        ;;
       (pop)
-    	_wanted -V 'applied patches' expl 'patch' compadd ${(f)"$(quilt applied)"}
-    	;;
+        tmp=$(quilt applied 2>&1)
+        if [[ "$tmp" != "No patches applied" ]]; then
+          _wanted -V 'applied patches' expl 'patch' compadd ${(f)"$(quilt applied)"}
+        fi
+        ;;
       (*)
-    	_files
-    	;;
+        _files
+        ;;
   esac
   ;;
 esac



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