summaryrefslogtreecommitdiffstats
path: root/extra/source/bash-completion/patches/0005-tar-Detect-GNU-other-from-version-only-once-per-sess.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extra/source/bash-completion/patches/0005-tar-Detect-GNU-other-from-version-only-once-per-sess.patch')
-rw-r--r--extra/source/bash-completion/patches/0005-tar-Detect-GNU-other-from-version-only-once-per-sess.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/extra/source/bash-completion/patches/0005-tar-Detect-GNU-other-from-version-only-once-per-sess.patch b/extra/source/bash-completion/patches/0005-tar-Detect-GNU-other-from-version-only-once-per-sess.patch
new file mode 100644
index 000000000..3e5e06e07
--- /dev/null
+++ b/extra/source/bash-completion/patches/0005-tar-Detect-GNU-other-from-version-only-once-per-sess.patch
@@ -0,0 +1,46 @@
+From 88c671a2c74bfde3bc2ec7c6f74133ac613c61da Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
+Date: Wed, 16 Mar 2016 12:44:40 +0200
+Subject: [PATCH 5/5] tar: Detect GNU/other from --version only once per
+ session
+
+---
+ completions/tar | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/completions/tar b/completions/tar
+index 9c44dc7..7b3a486 100644
+--- a/completions/tar
++++ b/completions/tar
+@@ -696,16 +696,25 @@ _posix_tar()
+
+ _tar()
+ {
+- local cmd=${COMP_WORDS[0]} line
++ local cmd=${COMP_WORDS[0]} func line
+ read line <<<"$($cmd --version)"
+ case "$line" in
+ *GNU*)
+- _gtar "$@"
++ func=_gtar
+ ;;
+ *)
+- _posix_tar "$@"
++ func=_posix_tar
+ ;;
+ esac
++ $func "$@"
++
++ # Install real completion for subsequent completions
++ if [ -n "${COMP_TAR_INTERNAL_PATHS:-}" ]; then
++ complete -F $func -o dirnames tar
++ else
++ complete -F $func tar
++ fi
++ unset -f _tar
+ }
+
+
+--
+2.7.2
+