From: Junio C Hamano <gitster@pobox.com>
To: Fien Dora <fiendora5@gmail.com>
Cc: git@vger.kernel.org, christian.couder@gmail.com,
siddharthasthana31@gmail.com, phillip.wood123@gmail.com
Subject: Re: [Outreachy PATCH] t1402: test --no-allow-onelevel option precedence
Date: Mon, 26 Oct 2026 14:06:40 -0700 [thread overview]
Message-ID: <xmqqfqxsp3xb.fsf@gitster.g> (raw)
In-Reply-To: <20261026132525.45414-1-fiendora5@gmail.com> (Fien Dora's message of "Mon, 26 Oct 2026 14:25:25 +0100")
Fien Dora <fiendora5@gmail.com> writes:
> Git allows later command-line options to override earlier ones.
> Added tests to verify that --no-allow-onelevel overrides
> --allow-onelevel and vice versa.
There are many other commands that take --[no-]foo options and a
later --no-foo overrides an earlier --foo (and vice versa), and most
of them do use the parse_options() API. It probably is not worth
our brain cycles to add tests to cover all these other commands to
cover all these options that can be negated in a way similar to this
patch does for the ones based on parse_options().
What makes check-ref-format somewhat special is that it does not use
the parse_options() API to handle command line options, and instead
uses a handcrafted loop to parse them. Covering the behaviour of
the command with tests may therefore make a bit more sense than all
the others.
> This ensures that the expected behavior is preserved if the
> argument-parsing code changes in the future.
So I would say that we need two changes to the log message:
* The rationale should highlight why check-ref-format is special
and deserves to have this pretty common "no- prefix negates"
behaviour tested (i.e., it is a handcrafted parse loop); and
* We have immediate plan to rewrite the option parsing logic (i.e.,
not a vague "if we change it in the fiture").
to sell this change better.
Thanks.
>
> Signed-off-by: Fien Dora <fiendora5@gmail.com>
> ---
> t/t1402-check-ref-format.sh | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh
> index 9dd64662b2..6036df0210 100755
> --- a/t/t1402-check-ref-format.sh
> +++ b/t/t1402-check-ref-format.sh
> @@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern
> ref='foo'
> invalid_ref "$ref"
> valid_ref "$ref" --allow-onelevel
> +invalid_ref "$ref" '--allow-onelevel --no-allow-onelevel'
> +valid_ref "$ref" '--no-allow-onelevel --allow-onelevel'
> invalid_ref "$ref" --refspec-pattern
> valid_ref "$ref" '--refspec-pattern --allow-onelevel'
> invalid_ref "$ref" --normalize
next prev parent reply other threads:[~2026-10-26 21:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 13:25 [Outreachy PATCH] t1402: test --no-allow-onelevel option precedence Fien Dora
2026-10-26 21:06 ` Junio C Hamano [this message]
2026-10-27 11:56 ` Fien Dora
2026-10-27 16:29 ` Junio C Hamano
2026-10-28 19:49 ` Fien Dora
2026-10-28 20:00 ` Fien Dora
2026-10-27 14:54 ` [Outreachy PATCH v2] " Fien Dora
2026-10-27 17:59 ` Junio C Hamano
2026-10-28 20:22 ` Fien Dora
2026-10-29 12:17 ` [Outreachy PATCH v3] " Fien Dora
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=xmqqfqxsp3xb.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=fiendora5@gmail.com \
--cc=git@vger.kernel.org \
--cc=phillip.wood123@gmail.com \
--cc=siddharthasthana31@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