From: Tanga Joris Date: Thu, 05 Nov 2026 00:39:13 GMT Subject: [Outreachy PATCH v4 3/3] t0012: catch builtins that keep NO_PARSEOPT after conversion Message-ID: <20261105003914.708836-3-tangajoris@gmail.com> In-Reply-To: <20261105003914.708836-1-tangajoris@gmail.com> When a builtin is converted to parse-options, the NO_PARSEOPT flag in git.c has to be removed by hand. No test checks this. The previous commit removes the flag from four builtins where it was left behind. Add a test that runs "git --git-completion-helper" for every builtin left out of "git --list-cmds=parseopt". The test fails if the command prints an option starting with "--". Without the previous commit, it fails for diff-pairs, fast-import and patch-id. The test skips diff, diff-files, diff-index, diff-tree and rev-list, because they print the diff options. It also skips rev-parse, because it prints the argument back. It does not catch var, because var only has short options (like -l) and the helper only lists long options. Suggested-by: Kaartic Sivaraam Signed-off-by: Tanga Joris --- Kaartic, I put your test in a separate patch for now, so it is easy to find. I'm happy to squash it into 2/3 if you prefer it there. t/t0012-help.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/t0012-help.sh b/t/t0012-help.sh index b0a3fdbbbc..41197c67e2 100755 --- a/t/t0012-help.sh +++ b/t/t0012-help.sh @@ -267,4 +267,29 @@ do ' done parseopt && + tr " " "\n" sorted-parseopt && + sort builtins >sorted-builtins && + comm -23 sorted-builtins sorted-parseopt >no-parseopt +' + +while read builtin +do + case "$builtin" in + # these answer with the diff options + diff|diff-files|diff-index|diff-tree|rev-list) + continue ;; + # rev-parse prints unknown arguments back + rev-parse) + continue ;; + esac + + test_expect_success "$builtin does not answer --git-completion-helper" ' + test_might_fail git $builtin --git-completion-helper \ + output 2>/dev/null && + test_grep ! "^--" output + ' +done