Skip to content

Commit 2b9bd48

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f1d4a28 commit 2b9bd48

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

contrib/completion/git-completion.bash

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,15 +2004,18 @@ _git_range_diff ()
20042004
__git_complete_revlist
20052005
}
20062006

2007+
__git_rebase_inprogress_options="--continue --skip --abort --quit --show-current-patch"
2008+
__git_rebase_interactive_inprogress_options="$__git_rebase_inprogress_options --edit-todo"
2009+
20072010
_git_rebase ()
20082011
{
20092012
__git_find_repo_path
20102013
if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
2011-
__gitcomp "--continue --skip --abort --quit --edit-todo --show-current-patch"
2014+
__gitcomp "$__git_rebase_interactive_inprogress_options"
20122015
return
20132016
elif [ -d "$__git_repo_path"/rebase-apply ] || \
20142017
[ -d "$__git_repo_path"/rebase-merge ]; then
2015-
__gitcomp "--continue --skip --abort --quit --show-current-patch"
2018+
__gitcomp "$__git_rebase_inprogress_options"
20162019
return
20172020
fi
20182021
__git_complete_strategy && return
@@ -2022,19 +2025,8 @@ _git_rebase ()
20222025
return
20232026
;;
20242027
--*)
2025-
__gitcomp "
2026-
--onto --merge --strategy --interactive
2027-
--rebase-merges --preserve-merges --stat --no-stat
2028-
--committer-date-is-author-date --ignore-date
2029-
--ignore-whitespace --whitespace=
2030-
--autosquash --no-autosquash
2031-
--fork-point --no-fork-point
2032-
--autostash --no-autostash
2033-
--verify --no-verify
2034-
--keep-empty --root --force-rebase --no-ff
2035-
--rerere-autoupdate
2036-
--exec
2037-
"
2028+
__gitcomp_builtin rebase "" \
2029+
"$__git_rebase_interactive_inprogress_options"
20382030

20392031
return
20402032
esac

0 commit comments

Comments
 (0)