mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
completions/git: Rely on local completion
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
This commit is contained in:
committed by
Koichi Murase
parent
20fa827b89
commit
5ea1aa6b7e
27
completions/git.completion.bash
Normal file
27
completions/git.completion.bash
Normal file
@@ -0,0 +1,27 @@
|
||||
# bash completion support for Git.
|
||||
|
||||
if ! _omb_util_function_exists __gitdir; then
|
||||
is_completion_loaded=0
|
||||
for path in $(type -aP git);
|
||||
do
|
||||
path="${path%/git}"
|
||||
prefix="${path%/bin}"
|
||||
# echo "[debug] Checking $prefix"
|
||||
for file in share/bash-completion/completions/git share/git-core/contrib/completion/git-completion.bash;
|
||||
do
|
||||
_file="$prefix/$file"
|
||||
if [[ -f $_file && -r $_file ]]; then
|
||||
echo "[debug] Loading $_file"
|
||||
is_completion_loaded=1
|
||||
source "$_file"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [[ $is_completion_loaded == 0 ]]; then
|
||||
# echo "[debug] No completion found: fallbacking"
|
||||
source "$OSH/tools/git-completion.bash"
|
||||
fi
|
||||
# else
|
||||
# echo "[debug] __gitdir is a defined function: doing nothing"
|
||||
fi
|
Reference in New Issue
Block a user