From: Tanga Joris <tangajoris@gmail.com>
To: git@vger.kernel.org
Cc: l.s.r@web.de, gitster@pobox.com, christian.couder@gmail.com,
siddharthasthana31@gmail.com, kaartic.sivaraam@gmail.com,
usmanakinyemi202@gmail.com, herroyalpriestess@gmail.com,
Tanga Joris <tangajoris@gmail.com>
Subject: [Outreachy PATCH v4 3/3] t0012: catch builtins that keep NO_PARSEOPT after conversion
Date: Thu, 5 Nov 2026 03:39:13 +0300 [thread overview]
Message-ID: <20261105003914.708836-3-tangajoris@gmail.com> (raw)
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 <cmd> --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 <kaartic.sivaraam@gmail.com>
Signed-off-by: Tanga Joris <tangajoris@gmail.com>
---
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 <builtins
+test_expect_success 'generate list of builtins without parse-options' '
+ git --list-cmds=parseopt >parseopt &&
+ tr " " "\n" <parseopt | sort >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 \
+ </dev/null >output 2>/dev/null &&
+ test_grep ! "^--" output
+ '
+done <no-parseopt
+
test_done
--
2.43.0
next prev parent reply other threads:[~2026-11-05 0:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 5:24 [Outreachy PATCH] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
2026-10-25 7:59 ` René Scharfe
2026-10-26 2:59 ` Tanga Joris
2026-10-26 4:58 ` Junio C Hamano
2026-10-29 1:26 ` [Outreachy PATCH v2 1/2] fast-import: handle --git-completion-helper before reading input Tanga Joris
2026-10-29 1:26 ` [Outreachy PATCH v2 2/2] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
2026-10-29 18:04 ` [Outreachy PATCH v2 1/2] fast-import: handle --git-completion-helper before reading input Junio C Hamano
2026-10-29 23:16 ` [Outreachy PATCH v3 1/2] parse-options: answer --git-completion-helper before command runs Tanga Joris
2026-10-29 23:16 ` [Outreachy PATCH v3 2/2] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
2026-10-30 10:21 ` Kaartic Sivaraam
2026-11-02 2:26 ` Tanga Joris
2026-10-30 9:44 ` [Outreachy PATCH v3 1/2] parse-options: answer --git-completion-helper before command runs Kaartic Sivaraam
2026-10-31 22:01 ` Tanga Joris
2026-11-03 9:25 ` Cynthia Uche
2026-11-04 22:34 ` Tanga Joris
2026-11-05 0:39 ` [Outreachy PATCH v4 1/3] " Tanga Joris
2026-11-05 0:39 ` [Outreachy PATCH v4 2/3] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
2026-11-05 0:39 ` Tanga Joris [this message]
2026-11-05 15:32 ` [Outreachy PATCH v4 1/3] parse-options: answer --git-completion-helper before command runs Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261105003914.708836-3-tangajoris@gmail.com \
--to=tangajoris@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=herroyalpriestess@gmail.com \
--cc=kaartic.sivaraam@gmail.com \
--cc=l.s.r@web.de \
--cc=siddharthasthana31@gmail.com \
--cc=usmanakinyemi202@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox