development/tig: Fix __git_complete: command not found.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Willy Sudiarto Raharjo 2020-06-11 15:13:16 +07:00
parent fc8fc7fcf0
commit a8b34999f8
No known key found for this signature in database
GPG key ID: 3F617144D7238786
2 changed files with 49 additions and 1 deletions

View file

@ -0,0 +1,47 @@
From dff2d346e9647fb55c4e0e381572ad1fe82b8715 Mon Sep 17 00:00:00 2001
From: Kyle Anderson <kylea@netflix.com>
Date: Mon, 8 Jun 2020 17:24:18 -0700
Subject: [PATCH] Don't error if git tab completion is not available. Fixes
#1011
---
contrib/tig-completion.bash | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/contrib/tig-completion.bash b/contrib/tig-completion.bash
index 5aef3fd8..54a40ec1 100755
--- a/contrib/tig-completion.bash
+++ b/contrib/tig-completion.bash
@@ -28,6 +28,9 @@
# is performed while the script loads. If git isn't found
# at source time then all lookups will be done on demand,
# which may be slightly slower.
+#
+# 4) This completion file depends on git completion already being
+# loaded. Make sure git-completion.bash happens first.
__tig_options="
-v --version
@@ -93,13 +96,15 @@ if [ -n "$ZSH_VERSION" ]; then
bashcompinit
fi
-# we use internal git-completion functions, so wrap _tig for all necessary
+# we use internal git-completion functions (if available), so wrap _tig for all necessary
# variables (like cword and prev) to be defined
-__git_complete tig _tig
+if type '__git_complete' 2>/dev/null | grep -q 'function'; then
+ __git_complete tig _tig
-# The following are necessary only for Cygwin, and only are needed
-# when the user has tab-completed the executable name and consequently
-# included the '.exe' suffix.
-if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
- __git_complete tig.exe _tig
+ # The following are necessary only for Cygwin, and only are needed
+ # when the user has tab-completed the executable name and consequently
+ # included the '.exe' suffix.
+ if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
+ __git_complete tig.exe _tig
+ fi
fi

View file

@ -24,7 +24,7 @@
PRGNAM=tig
VERSION=${VERSION:-2.5.1}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -70,6 +70,7 @@ find -L . \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
sed -i 's|$(docdir)/tig|$(docdir)|' Makefile
patch -p1 < $CWD/1016.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \