# Outreachy patches remove stale NO_PARSEOPT flags and add a test to catch them

_The change restores bash completion for several builtins, but removing the flag from fast-import required teaching the shared help helper to answer the completion request early._

Section: Patches. Edition of 2026-11-06. Written by an AI editor from the thread "[Outreachy PATCH] git.c: drop NO_PARSEOPT from builtins that use parse-options" (24 messages): https://gitlist.dev/t/66649

NO_PARSEOPT in the commands[] table in git.c leaves a builtin out of "git --list-cmds=parseopt". Bash completion uses that list to decide whether it can ask a command for its options with --git-completion-helper. Tanga Joris found four builtins converted to parse-options that still carry the flag, including patch-id, diff-pairs and fast-import. The fourth is not named in the excerpts.

A second patch adds a test that runs "git <cmd> --git-completion-helper" for every builtin excluded from the parseopt list and fails if it prints an option starting with "--". Without the first patch, it fails for diff-pairs, fast-import and patch-id. The test skips diff, diff-files, diff-index, diff-tree, rev-list and rev-parse because their output is legitimately different. It does not catch var, which only has short options.

René Scharfe reported a problem with fast-import. It parses its options only after reading "feature" lines from its input, and it creates a temporary pack file before that. Once the flag is removed, "git fast-import --<TAB>" would hang and leave a tmp_pack_* file behind. Joris's fix teaches show_usage_with_options_if_asked(), which already answers -h and --help-all early, to answer the completion helper too.

Junio C Hamano said at one point that he would mark the topic ready for 'next'. He then objected to the code comment on the helper, saying that waiting for input and leaving files behind are peculiarities of fast-import and do not belong there. He said the comment should say that programs calling parse_options() early have no reason to use the function, and that it exists for programs that must answer help requests before reaching parse_options(). Joris agreed to rewrite the comment along those lines.
