summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2014-01-07 16:56:16 +0100
committerJean Delvare <jdelvare@suse.de>2014-01-07 16:56:16 +0100
commitf535e6f731668035a3fa2472628ba82146ea7262 (patch)
treeb7d4adf847685104973dca88f359c917d7a83fe1
parent1e6241bbb544b69f022a5c7e00d2e0b61bc1ec33 (diff)
downloadquilt-f535e6f731668035a3fa2472628ba82146ea7262.tar.gz
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
-rw-r--r--bash_completion37
1 files changed, 21 insertions, 16 deletions
diff --git a/bash_completion b/bash_completion
index 19736cb..0918598 100644
--- a/bash_completion
+++ b/bash_completion
@@ -6,6 +6,11 @@
# This file is part of the distribution of quilt, and is distributed under
# the same licence than quilt itself
+# WARNING: This script doesn't read user or system quiltrc files, and assumes
+# that QUILT_PC is left unchanged. If you have changed QUILT_PC and want
+# completion to work then you must set QUILT_PC in your global environment
+# (for example in ~/.profile) and not just in your quiltrc file.
+
if type quilt &> /dev/null ; then
if ! type _expand &> /dev/null ; then
@@ -123,7 +128,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 +139,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 +148,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 +159,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 +176,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 +203,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 +212,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 +234,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 +254,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 +272,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 +297,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)
;;