completion: teach rebase to use __gitcomp_builtin
Currently, _git_rebase() uses a hardcoded list of options for its completion. However, we can use __gitcomp_builtin() to get a dynamically generated list of completions instead. Teach _git_rebase() to use __gitcomp_builtin() so that newly implemented options in rebase will be automatically completed without any mucking around in git-completion.bash. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
f1d4a28250
commit
2b9bd488ae
|
@ -2004,15 +2004,18 @@ _git_range_diff ()
|
||||||
__git_complete_revlist
|
__git_complete_revlist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__git_rebase_inprogress_options="--continue --skip --abort --quit --show-current-patch"
|
||||||
|
__git_rebase_interactive_inprogress_options="$__git_rebase_inprogress_options --edit-todo"
|
||||||
|
|
||||||
_git_rebase ()
|
_git_rebase ()
|
||||||
{
|
{
|
||||||
__git_find_repo_path
|
__git_find_repo_path
|
||||||
if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
|
if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
|
||||||
__gitcomp "--continue --skip --abort --quit --edit-todo --show-current-patch"
|
__gitcomp "$__git_rebase_interactive_inprogress_options"
|
||||||
return
|
return
|
||||||
elif [ -d "$__git_repo_path"/rebase-apply ] || \
|
elif [ -d "$__git_repo_path"/rebase-apply ] || \
|
||||||
[ -d "$__git_repo_path"/rebase-merge ]; then
|
[ -d "$__git_repo_path"/rebase-merge ]; then
|
||||||
__gitcomp "--continue --skip --abort --quit --show-current-patch"
|
__gitcomp "$__git_rebase_inprogress_options"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
__git_complete_strategy && return
|
__git_complete_strategy && return
|
||||||
|
@ -2022,19 +2025,8 @@ _git_rebase ()
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp_builtin rebase "" \
|
||||||
--onto --merge --strategy --interactive
|
"$__git_rebase_interactive_inprogress_options"
|
||||||
--rebase-merges --preserve-merges --stat --no-stat
|
|
||||||
--committer-date-is-author-date --ignore-date
|
|
||||||
--ignore-whitespace --whitespace=
|
|
||||||
--autosquash --no-autosquash
|
|
||||||
--fork-point --no-fork-point
|
|
||||||
--autostash --no-autostash
|
|
||||||
--verify --no-verify
|
|
||||||
--keep-empty --root --force-rebase --no-ff
|
|
||||||
--rerere-autoupdate
|
|
||||||
--exec
|
|
||||||
"
|
|
||||||
|
|
||||||
return
|
return
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue