@@ -13,6 +13,25 @@ complete ()
1313 return 0
1414}
1515
16+ # Be careful when updating this list:
17+ #
18+ # (1) The build tree may have build artifact from different branch, or
19+ # the user's $PATH may have a random executable that may begin
20+ # with "git-check" that are not part of the subcommands this build
21+ # will ship, e.g. "check-ignore". The tests for completion for
22+ # subcommand names tests how "check" is expanded; we limit the
23+ # possible candidates to "checkout" and "check-attr" to make sure
24+ # "check-attr", which is known by the filter function as a
25+ # subcommand to be thrown out, while excluding other random files
26+ # that happen to begin with "check" to avoid letting them get in
27+ # the way.
28+ #
29+ # (2) A test makes sure that common subcommands are included in the
30+ # completion for "git <TAB>", and a plumbing is excluded. "add",
31+ # "filter-branch" and "ls-files" are listed for this.
32+
33+ GIT_TESTING_COMMAND_COMPLETION=' add checkout check-attr filter-branch ls-files'
34+
1635. " $GIT_BUILD_DIR /contrib/completion/git-completion.bash"
1736
1837# We don't need this function to actually join words or do anything special.
@@ -196,7 +215,6 @@ test_expect_success 'general options plus command' '
196215 test_completion "git --paginate check" "checkout " &&
197216 test_completion "git --git-dir=foo check" "checkout " &&
198217 test_completion "git --bare check" "checkout " &&
199- test_completion "git --help des" "describe " &&
200218 test_completion "git --exec-path=foo check" "checkout " &&
201219 test_completion "git --html-path check" "checkout " &&
202220 test_completion "git --no-pager check" "checkout " &&
@@ -207,6 +225,11 @@ test_expect_success 'general options plus command' '
207225 test_completion "git --no-replace-objects check" "checkout "
208226'
209227
228+ test_expect_success ' git --help completion' '
229+ test_completion "git --help ad" "add " &&
230+ test_completion "git --help core" "core-tutorial "
231+ '
232+
210233test_expect_success ' setup for ref completion' '
211234 echo content >file1 &&
212235 echo more >file2 &&
0 commit comments