From: Jean Delvare <jdelvare@suse.de>
Subject: bash_completion: Fix completion of patch names

When the user's quilt configuration file (~/.quiltrc or
/etc/quilt.quiltrc) contains QUILT_PATCHES_PREFIX=yes (and the
default /etc/quilt.quiltrc does), bash completion chokes on patch
names. This is because quilt series, applied and unapplied return
relative patch names instead of the expected absolute patch names.

This can be solved by skipping configuration files when quilt is
called from the bash completion script.

This fixes bug #27111:
https://savannah.nongnu.org/bugs/index.php?27111
---
 bash_completion |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

--- a/bash_completion
+++ b/bash_completion
@@ -123,7 +123,7 @@ _quilt_completion()
 	add)
 	   case $prev in
 	     -P)
- 	        COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- $cur ) )
+ 	        COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 		;;
 	     *)
 	        _quilt_comfile
@@ -134,7 +134,7 @@ _quilt_completion()
 	annotate)
 	   case $prev in
 	     -P)
- 	        COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- $cur ) )
+ 	        COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 		;;
 	     *)
 	        _quilt_comfile
@@ -143,10 +143,10 @@ _quilt_completion()
 	   esac
 	   ;;
 	applied) 
-	   COMPREPLY=( $( compgen -W "-h $(quilt applied 2>/dev/null)" -- $cur ) )
+	   COMPREPLY=( $( compgen -W "-h $(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 	   ;;
 	delete) 
-	   COMPREPLY=( $( compgen -W "-n -r -h --backup $(quilt series)" -- $cur ) )
+	   COMPREPLY=( $( compgen -W "-n -r -h --backup $(quilt --quiltrc - series)" -- $cur ) )
 	   ;;
 	diff) 
 	   case $prev in
@@ -154,7 +154,7 @@ _quilt_completion()
  	        COMPREPLY=( $( compgen -W "0 1" -- $cur ) )
 		;;
 	     -P|--combine)
-	     	COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- $cur ) )
+	     	COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 		;;
 	     --diff|-U|-C)
 		;;
@@ -171,10 +171,10 @@ _quilt_completion()
 	files)
 	   case $prev in
 	     --combine)
-		COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 		;;
 	     *)
-		COMPREPLY=( $( compgen -W "-a -l -v -h --combine $(quilt applied 2>/dev/null)" -- $cur ) )
+		COMPREPLY=( $( compgen -W "-a -l -v -h --combine $(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 		;;
 	   esac
 	   ;;
@@ -198,7 +198,7 @@ _quilt_completion()
 	        COMPREPLY=( $( compgen -W "files" -- $cur ) )
 		;;
 	     *)
-		COMPREPLY=( $( compgen -W "-T -h --all --reduce --lines --edge-labels $(quilt applied 2>/dev/null)" -- $cur ) )
+		COMPREPLY=( $( compgen -W "-T -h --all --reduce --lines --edge-labels $(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 		;;
 	   esac
 	   ;;
@@ -207,7 +207,7 @@ _quilt_completion()
 	   COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-h" -- $cur ) )
 	   ;;
 	header)
-	   COMPREPLY=( $( compgen -W "-a -e -h -r --backup --strip-diffstat --strip-trailing-whitespace $(quilt series)" -- $cur ) )
+	   COMPREPLY=( $( compgen -W "-a -e -h -r --backup --strip-diffstat --strip-trailing-whitespace $(quilt --quiltrc - series)" -- $cur ) )
 	   ;;
 	import)
 	   case $prev in
@@ -229,17 +229,17 @@ _quilt_completion()
 	   COMPREPLY=( $( compgen -W "-m --prefix --mbox --send --sender --from --subject --to --cc --bcc" -- $cur ) )
 	   ;;
 	next|previous)
-	   COMPREPLY=( $( compgen -W "$(quilt series)" -- $cur ) )
+	   COMPREPLY=( $( compgen -W "$(quilt --quiltrc - series)" -- $cur ) )
 	   ;;
 	patches)
 	   _quilt_comfile 
 	   COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-v -h" -- $cur ) )
 	   ;;
 	pop)
-	   COMPREPLY=( $( compgen -W "-a -f -R -q -v -h $(quilt applied 2>/dev/null)" -- $cur ) )
+	   COMPREPLY=( $( compgen -W "-a -f -R -q -v -h $(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 	   ;;
 	push)
-	   COMPREPLY=( $( compgen -W "-a -f -q -v -h --leave-rejects --interactive --color $(quilt unapplied 2>/dev/null)" -- $cur ) )
+	   COMPREPLY=( $( compgen -W "-a -f -q -v -h --leave-rejects --interactive --color $(quilt --quiltrc - unapplied 2>/dev/null)" -- $cur ) )
 	   ;;
 	refresh)
 	   case $prev in
@@ -249,14 +249,14 @@ _quilt_completion()
 	     -U|-C)
 		;;
 	     *)
-	     	COMPREPLY=( $( compgen -W "-p -u -U -c -C -f -h $(quilt applied 2>/dev/null) --no-timestamps --no-index --diffstat --sort --backup --strip-trailing-whitespace" -- $cur ) )
+	     	COMPREPLY=( $( compgen -W "-p -u -U -c -C -f -h $(quilt --quiltrc - applied 2>/dev/null) --no-timestamps --no-index --diffstat --sort --backup --strip-trailing-whitespace" -- $cur ) )
 		;;
 	   esac
 	   ;;
 	remove|revert)
 	   case $prev in
 	     -P)
- 	        COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- $cur ) )
+ 	        COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
 		;;
 	     *)
 	        _quilt_comfile 
@@ -267,7 +267,7 @@ _quilt_completion()
 	rename)
 	   case $prev in
 	     -P)
-		COMPREPLY=( $( compgen -W "$(quilt series)" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$(quilt --quiltrc - series)" -- $cur ) )
 		;;
 	     *)
 		COMPREPLY=( $( compgen -W "-P -h" -- $cur ) )
@@ -292,7 +292,7 @@ _quilt_completion()
 	   COMPREPLY=( $( compgen -W "-d -h" -- $cur ) )
 	   ;;
 	unapplied)
-	   COMPREPLY=( $( compgen -W "-h $(quilt series)" -- $cur ) )
+	   COMPREPLY=( $( compgen -W "-h $(quilt --quiltrc - series)" -- $cur ) )
 	   ;;
 	fork|new|top|upgrade)
 	   ;;
