Merge branch 'sg/bash-completion'
* sg/bash-completion: bash: completion for gitk aliases bash: support user-supplied completion scripts for aliases bash: support user-supplied completion scripts for user's git commands bash: improve aliased command recognition
This commit is contained in:
@ -627,10 +627,19 @@ __git_aliased_command ()
|
|||||||
local word cmdline=$(git --git-dir="$(__gitdir)" \
|
local word cmdline=$(git --git-dir="$(__gitdir)" \
|
||||||
config --get "alias.$1")
|
config --get "alias.$1")
|
||||||
for word in $cmdline; do
|
for word in $cmdline; do
|
||||||
if [ "${word##-*}" ]; then
|
case "$word" in
|
||||||
echo $word
|
\!gitk|gitk)
|
||||||
|
echo "gitk"
|
||||||
return
|
return
|
||||||
fi
|
;;
|
||||||
|
\!*) : shell command alias ;;
|
||||||
|
-*) : option ;;
|
||||||
|
*=*) : setting env ;;
|
||||||
|
git) : git itself ;;
|
||||||
|
*)
|
||||||
|
echo "$word"
|
||||||
|
return
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1084,6 +1093,11 @@ _git_gc ()
|
|||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_git_gitk ()
|
||||||
|
{
|
||||||
|
_gitk
|
||||||
|
}
|
||||||
|
|
||||||
_git_grep ()
|
_git_grep ()
|
||||||
{
|
{
|
||||||
__git_has_doubledash && return
|
__git_has_doubledash && return
|
||||||
@ -1436,6 +1450,11 @@ _git_send_email ()
|
|||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_git_stage ()
|
||||||
|
{
|
||||||
|
_git_add
|
||||||
|
}
|
||||||
|
|
||||||
__git_config_get_set_variables ()
|
__git_config_get_set_variables ()
|
||||||
{
|
{
|
||||||
local prevword word config_file= c=$COMP_CWORD
|
local prevword word config_file= c=$COMP_CWORD
|
||||||
@ -2167,6 +2186,11 @@ _git_tag ()
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_git_whatchanged ()
|
||||||
|
{
|
||||||
|
_git_log
|
||||||
|
}
|
||||||
|
|
||||||
_git ()
|
_git ()
|
||||||
{
|
{
|
||||||
local i c=1 command __git_dir
|
local i c=1 command __git_dir
|
||||||
@ -2203,64 +2227,14 @@ _git ()
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local expansion=$(__git_aliased_command "$command")
|
local completion_func="_git_${command//-/_}"
|
||||||
[ "$expansion" ] && command="$expansion"
|
declare -F $completion_func >/dev/null && $completion_func && return
|
||||||
|
|
||||||
case "$command" in
|
local expansion=$(__git_aliased_command "$command")
|
||||||
am) _git_am ;;
|
if [ -n "$expansion" ]; then
|
||||||
add) _git_add ;;
|
completion_func="_git_${expansion//-/_}"
|
||||||
apply) _git_apply ;;
|
declare -F $completion_func >/dev/null && $completion_func
|
||||||
archive) _git_archive ;;
|
fi
|
||||||
bisect) _git_bisect ;;
|
|
||||||
bundle) _git_bundle ;;
|
|
||||||
branch) _git_branch ;;
|
|
||||||
checkout) _git_checkout ;;
|
|
||||||
cherry) _git_cherry ;;
|
|
||||||
cherry-pick) _git_cherry_pick ;;
|
|
||||||
clean) _git_clean ;;
|
|
||||||
clone) _git_clone ;;
|
|
||||||
commit) _git_commit ;;
|
|
||||||
config) _git_config ;;
|
|
||||||
describe) _git_describe ;;
|
|
||||||
diff) _git_diff ;;
|
|
||||||
difftool) _git_difftool ;;
|
|
||||||
fetch) _git_fetch ;;
|
|
||||||
format-patch) _git_format_patch ;;
|
|
||||||
fsck) _git_fsck ;;
|
|
||||||
gc) _git_gc ;;
|
|
||||||
grep) _git_grep ;;
|
|
||||||
help) _git_help ;;
|
|
||||||
init) _git_init ;;
|
|
||||||
log) _git_log ;;
|
|
||||||
ls-files) _git_ls_files ;;
|
|
||||||
ls-remote) _git_ls_remote ;;
|
|
||||||
ls-tree) _git_ls_tree ;;
|
|
||||||
merge) _git_merge;;
|
|
||||||
mergetool) _git_mergetool;;
|
|
||||||
merge-base) _git_merge_base ;;
|
|
||||||
mv) _git_mv ;;
|
|
||||||
name-rev) _git_name_rev ;;
|
|
||||||
notes) _git_notes ;;
|
|
||||||
pull) _git_pull ;;
|
|
||||||
push) _git_push ;;
|
|
||||||
rebase) _git_rebase ;;
|
|
||||||
remote) _git_remote ;;
|
|
||||||
replace) _git_replace ;;
|
|
||||||
reset) _git_reset ;;
|
|
||||||
revert) _git_revert ;;
|
|
||||||
rm) _git_rm ;;
|
|
||||||
send-email) _git_send_email ;;
|
|
||||||
shortlog) _git_shortlog ;;
|
|
||||||
show) _git_show ;;
|
|
||||||
show-branch) _git_show_branch ;;
|
|
||||||
stash) _git_stash ;;
|
|
||||||
stage) _git_add ;;
|
|
||||||
submodule) _git_submodule ;;
|
|
||||||
svn) _git_svn ;;
|
|
||||||
tag) _git_tag ;;
|
|
||||||
whatchanged) _git_log ;;
|
|
||||||
*) COMPREPLY=() ;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_gitk ()
|
_gitk ()
|
||||||
|
Reference in New Issue
Block a user