{"thread":{"id":"66665","subject":"[Outreachy PATCH] t1402: test --no-allow-onelevel option precedence","startedAt":"2026-10-26T13:25:25Z","lastAt":"2026-10-29T18:54:05Z","messageCount":11,"participants":["Fien Dora","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"556344","messageId":"20261026132525.45414-1-fiendora5@gmail.com","threadId":"66665","inReplyTo":null,"subject":"[Outreachy PATCH] t1402: test --no-allow-onelevel option precedence","fromName":"Fien Dora","fromEmail":"fiendora5@gmail.com","sentAt":"2026-10-26T13:25:25Z","receivedAt":"2026-10-26T13:25:25Z","isPatch":true,"sender":{"key":"fiendora5@gmail.com","avatar":null},"body":"Git allows later command-line options to override earlier ones.\nAdded tests to verify that --no-allow-onelevel overrides\n--allow-onelevel and vice versa.\n\nThis ensures that the expected behavior is preserved if the\nargument-parsing code changes in the future.\n\nSigned-off-by: Fien Dora <fiendora5@gmail.com>\n---\n t/t1402-check-ref-format.sh | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh\nindex 9dd64662b2..6036df0210 100755\n--- a/t/t1402-check-ref-format.sh\n+++ b/t/t1402-check-ref-format.sh\n@@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern\n ref='foo'\n invalid_ref \"$ref\"\n valid_ref \"$ref\" --allow-onelevel\n+invalid_ref \"$ref\" '--allow-onelevel --no-allow-onelevel'\n+valid_ref \"$ref\" '--no-allow-onelevel --allow-onelevel'\n invalid_ref \"$ref\" --refspec-pattern\n valid_ref \"$ref\" '--refspec-pattern --allow-onelevel'\n invalid_ref \"$ref\" --normalize\n-- \n2.50.1 (Apple Git-155)\n\n\n"},{"id":"556405","messageId":"xmqqfqxsp3xb.fsf@gitster.g","threadId":"66665","inReplyTo":"20261026132525.45414-1-fiendora5@gmail.com","subject":"Re: [Outreachy PATCH] t1402: test --no-allow-onelevel option precedence","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-26T21:06:40Z","receivedAt":"2026-10-26T21:06:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fien Dora <fiendora5@gmail.com> writes:\n\n> Git allows later command-line options to override earlier ones.\n> Added tests to verify that --no-allow-onelevel overrides\n> --allow-onelevel and vice versa.\n\nThere are many other commands that take --[no-]foo options and a\nlater --no-foo overrides an earlier --foo (and vice versa), and most\nof them do use the parse_options() API.  It probably is not worth\nour brain cycles to add tests to cover all these other commands to\ncover all these options that can be negated in a way similar to this\npatch does for the ones based on parse_options().\n\nWhat makes check-ref-format somewhat special is that it does not use\nthe parse_options() API to handle command line options, and instead\nuses a handcrafted loop to parse them.  Covering the behaviour of\nthe command with tests may therefore make a bit more sense than all\nthe others.\n\n> This ensures that the expected behavior is preserved if the\n> argument-parsing code changes in the future.\n\nSo I would say that we need two changes to the log message:\n\n * The rationale should highlight why check-ref-format is special\n   and deserves to have this pretty common \"no- prefix negates\"\n   behaviour tested (i.e., it is a handcrafted parse loop); and\n\n * We have immediate plan to rewrite the option parsing logic (i.e.,\n   not a vague \"if we change it in the fiture\").\n\nto sell this change better.\n\nThanks.\n\n>\n> Signed-off-by: Fien Dora <fiendora5@gmail.com>\n> ---\n>  t/t1402-check-ref-format.sh | 2 ++\n>  1 file changed, 2 insertions(+)\n>\n> diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh\n> index 9dd64662b2..6036df0210 100755\n> --- a/t/t1402-check-ref-format.sh\n> +++ b/t/t1402-check-ref-format.sh\n> @@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern\n>  ref='foo'\n>  invalid_ref \"$ref\"\n>  valid_ref \"$ref\" --allow-onelevel\n> +invalid_ref \"$ref\" '--allow-onelevel --no-allow-onelevel'\n> +valid_ref \"$ref\" '--no-allow-onelevel --allow-onelevel'\n>  invalid_ref \"$ref\" --refspec-pattern\n>  valid_ref \"$ref\" '--refspec-pattern --allow-onelevel'\n>  invalid_ref \"$ref\" --normalize\n\n"},{"id":"556488","messageId":"CACWAS-U2-riX0ajiaE4VgiQWxmoWcL-d9-arrSASa+dnVxoyEA@mail.gmail.com","threadId":"66665","inReplyTo":"xmqqfqxsp3xb.fsf@gitster.g","subject":"Re: [Outreachy PATCH] t1402: test --no-allow-onelevel option precedence","fromName":"Fien Dora","fromEmail":"fiendora5@gmail.com","sentAt":"2026-10-27T11:56:47Z","receivedAt":"2026-10-27T11:56:47Z","isPatch":true,"sender":{"key":"fiendora5@gmail.com","avatar":null},"body":"Thank you for the feedback.\n\nI'll revise the commit message to better explain why check-ref-format\nneeds these tests, with the rationale highlighting its handcrafted\noption-parsing loop and the planned conversion to parse_options(),\nthen send a v2 patch.\n\nThank you\n\nOn Mon, 26 Oct 2026 at 22:06, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Fien Dora <fiendora5@gmail.com> writes:\n>\n> > Git allows later command-line options to override earlier ones.\n> > Added tests to verify that --no-allow-onelevel overrides\n> > --allow-onelevel and vice versa.\n>\n> There are many other commands that take --[no-]foo options and a\n> later --no-foo overrides an earlier --foo (and vice versa), and most\n> of them do use the parse_options() API.  It probably is not worth\n> our brain cycles to add tests to cover all these other commands to\n> cover all these options that can be negated in a way similar to this\n> patch does for the ones based on parse_options().\n>\n> What makes check-ref-format somewhat special is that it does not use\n> the parse_options() API to handle command line options, and instead\n> uses a handcrafted loop to parse them.  Covering the behaviour of\n> the command with tests may therefore make a bit more sense than all\n> the others.\n>\n> > This ensures that the expected behavior is preserved if the\n> > argument-parsing code changes in the future.\n>\n> So I would say that we need two changes to the log message:\n>\n>  * The rationale should highlight why check-ref-format is special\n>    and deserves to have this pretty common \"no- prefix negates\"\n>    behaviour tested (i.e., it is a handcrafted parse loop); and\n>\n>  * We have immediate plan to rewrite the option parsing logic (i.e.,\n>    not a vague \"if we change it in the fiture\").\n>\n> to sell this change better.\n>\n> Thanks.\n>\n> >\n> > Signed-off-by: Fien Dora <fiendora5@gmail.com>\n> > ---\n> >  t/t1402-check-ref-format.sh | 2 ++\n> >  1 file changed, 2 insertions(+)\n> >\n> > diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh\n> > index 9dd64662b2..6036df0210 100755\n> > --- a/t/t1402-check-ref-format.sh\n> > +++ b/t/t1402-check-ref-format.sh\n> > @@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern\n> >  ref='foo'\n> >  invalid_ref \"$ref\"\n> >  valid_ref \"$ref\" --allow-onelevel\n> > +invalid_ref \"$ref\" '--allow-onelevel --no-allow-onelevel'\n> > +valid_ref \"$ref\" '--no-allow-onelevel --allow-onelevel'\n> >  invalid_ref \"$ref\" --refspec-pattern\n> >  valid_ref \"$ref\" '--refspec-pattern --allow-onelevel'\n> >  invalid_ref \"$ref\" --normalize\n\n"},{"id":"556515","messageId":"20261027145451.8617-1-fiendora5@gmail.com","threadId":"66665","inReplyTo":"20261026132525.45414-1-fiendora5@gmail.com","subject":"[Outreachy PATCH v2] t1402: test --no-allow-onelevel option precedence","fromName":"Fien Dora","fromEmail":"fiendora5@gmail.com","sentAt":"2026-10-27T14:54:51Z","receivedAt":"2026-10-27T14:54:51Z","isPatch":true,"sender":{"key":"fiendora5@gmail.com","avatar":null},"body":"Unlike most Git commands that use the parse_options() API,\ncheck-ref-format relies on a handcrafted loop to parse command-line\noptions. Although the --no- prefix is commonly used to negate options\nin Git, the precedence of --allow-onelevel and --no-allow-onelevel\nis not explicitly covered by the existing tests.\n\nAdd regression tests for both orders of --allow-onelevel and\n--no-allow-onelevel to verify that the last option takes precedence.\nThe tests confirm that --no-allow-onelevel overrides a preceding\n--allow-onelevel, and that --allow-onelevel similarly overrides a\npreceding --no-allow-onelevel.\n\nGit's planned work to improve argument parsing includes replacing\nsuitable handcrafted parsers with existing APIs. These tests\nestablish check-ref-format's current option precedence behavior\nso it can be preserved when its parsing logic is updated.\n\nSigned-off-by: Fien Dora <fiendora5@gmail.com>\n---\n\nChanges since v1:\n- Explain why check-ref-format's handcrafted parser needs\n  explicit option-precedence tests.\n- Clarify how the tests relate to Git's planned parsing work.\n- No changes to the test code.\n\n t/t1402-check-ref-format.sh | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh\nindex 9dd64662b2..6036df0210 100755\n--- a/t/t1402-check-ref-format.sh\n+++ b/t/t1402-check-ref-format.sh\n@@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern\n ref='foo'\n invalid_ref \"$ref\"\n valid_ref \"$ref\" --allow-onelevel\n+invalid_ref \"$ref\" '--allow-onelevel --no-allow-onelevel'\n+valid_ref \"$ref\" '--no-allow-onelevel --allow-onelevel'\n invalid_ref \"$ref\" --refspec-pattern\n valid_ref \"$ref\" '--refspec-pattern --allow-onelevel'\n invalid_ref \"$ref\" --normalize\n-- \n2.50.1 (Apple Git-155)\n\n\n"},{"id":"556528","messageId":"xmqqpkwvm7j8.fsf@gitster.g","threadId":"66665","inReplyTo":"CACWAS-U2-riX0ajiaE4VgiQWxmoWcL-d9-arrSASa+dnVxoyEA@mail.gmail.com","subject":"Re: [Outreachy PATCH] t1402: test --no-allow-onelevel option precedence","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-27T16:29:15Z","receivedAt":"2026-10-27T16:29:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fien Dora <fiendora5@gmail.com> writes:\n\n> Thank you for the feedback.\n>\n> I'll revise the commit message to better explain why check-ref-format\n> needs these tests, with the rationale highlighting its handcrafted\n> option-parsing loop and the planned conversion to parse_options(),\n> then send a v2 patch.\n>\n> Thank you\n\nPlease do not top-post.  Your response will come _after_ the lines you\nquote from the message you are responding to.\n\nAnd trim your quote to the parts necessary for bystanders to understand\nwhat is being discussed.  Do not quote the entire message.\n\nThanks.\n\n"},{"id":"556549","messageId":"xmqqcxsvkorm.fsf@gitster.g","threadId":"66665","inReplyTo":"20261027145451.8617-1-fiendora5@gmail.com","subject":"Re: [Outreachy PATCH v2] t1402: test --no-allow-onelevel option precedence","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-27T17:59:57Z","receivedAt":"2026-10-27T17:59:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fien Dora <fiendora5@gmail.com> writes:\n\n> Unlike most Git commands that use the parse_options() API,\n> check-ref-format relies on a handcrafted loop to parse command-line\n> options. Although the --no- prefix is commonly used to negate options\n> in Git, the precedence of --allow-onelevel and --no-allow-onelevel\n> is not explicitly covered by the existing tests.\n>\n> Add regression tests for both orders of --allow-onelevel and\n> --no-allow-onelevel to verify that the last option takes precedence.\n> The tests confirm that --no-allow-onelevel overrides a preceding\n> --allow-onelevel, and that --allow-onelevel similarly overrides a\n> preceding --no-allow-onelevel.\n\nNicely described.\n\n> Git's planned work to improve argument parsing includes replacing\n> suitable handcrafted parsers with existing APIs.\n\nI haven't heard of anybody planning to do such a conversion, but do\nyou mean you are planning to do such a work as a follow-up?  If so,\nwrite it more like \"I plan to do X in a separate series\".  If not,\nplease do not make up hallucinated facts.\n\n> Signed-off-by: Fien Dora <fiendora5@gmail.com>\n> ---\n>\n>  t/t1402-check-ref-format.sh | 2 ++\n>  1 file changed, 2 insertions(+)\n>\n> diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh\n> index 9dd64662b2..6036df0210 100755\n> --- a/t/t1402-check-ref-format.sh\n> +++ b/t/t1402-check-ref-format.sh\n> @@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern\n>  ref='foo'\n>  invalid_ref \"$ref\"\n>  valid_ref \"$ref\" --allow-onelevel\n> +invalid_ref \"$ref\" '--allow-onelevel --no-allow-onelevel'\n> +valid_ref \"$ref\" '--no-allow-onelevel --allow-onelevel'\n>  invalid_ref \"$ref\" --refspec-pattern\n>  valid_ref \"$ref\" '--refspec-pattern --allow-onelevel'\n>  invalid_ref \"$ref\" --normalize\n\n"},{"id":"556698","messageId":"CACWAS-Uc3WvgGsPC450nD_+ZGjdgf4PFo+gHpYhAbfziEq3F5g@mail.gmail.com","threadId":"66665","inReplyTo":"xmqqpkwvm7j8.fsf@gitster.g","subject":"Re: [Outreachy PATCH] t1402: test --no-allow-onelevel option precedence","fromName":"Fien Dora","fromEmail":"fiendora5@gmail.com","sentAt":"2026-10-28T19:49:52Z","receivedAt":"2026-10-28T19:49:52Z","isPatch":true,"sender":{"key":"fiendora5@gmail.com","avatar":null},"body":"> Please do not top-post.  Your response will come _after_ the lines you\n> quote from the message you are responding to.\n> And trim your quote to the parts necessary for bystanders to understand\n> what is being discussed.  Do not quote the entire message.\n\nThank you very much, Junio, for your guidance,\n\nI now understand the convention, I will implement it in my future replies\n\nThank you\n\nOn Tue, 27 Oct 2026 at 17:29, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Fien Dora <fiendora5@gmail.com> writes:\n>\n> > Thank you for the feedback.\n> >\n> > I'll revise the commit message to better explain why check-ref-format\n> > needs these tests, with the rationale highlighting its handcrafted\n> > option-parsing loop and the planned conversion to parse_options(),\n> > then send a v2 patch.\n> >\n> > Thank you\n>\n> Please do not top-post.  Your response will come _after_ the lines you\n> quote from the message you are responding to.\n>\n> And trim your quote to the parts necessary for bystanders to understand\n> what is being discussed.  Do not quote the entire message.\n>\n> Thanks.\n\n"},{"id":"556701","messageId":"CACWAS-WBYxD8FhMRRyyeEjsek=0Oitd83PUBxqMWEX8uZk8CGg@mail.gmail.com","threadId":"66665","inReplyTo":"xmqqpkwvm7j8.fsf@gitster.g","subject":"Re: [Outreachy PATCH] t1402: test --no-allow-onelevel option precedence","fromName":"Fien Dora","fromEmail":"fiendora5@gmail.com","sentAt":"2026-10-28T20:00:34Z","receivedAt":"2026-10-28T20:00:34Z","isPatch":true,"sender":{"key":"fiendora5@gmail.com","avatar":null},"body":"> Fien Dora <fiendora5@gmail.com> writes:\n\n> Please do not top-post.  Your response will come _after_ the lines you\n> quote from the message you are responding to.\n>\n> And trim your quote to the parts necessary for bystanders to understand\n> what is being discussed.  Do not quote the entire message.\n\nThank you very much, Junio, for your guidance.\n\nI now understand the convention, I will apply them in my future replies\n\nThank you\n\n"},{"id":"556704","messageId":"CACWAS-X=fFnQayFiUEa=PyCEC8J4csuSzL-kbgND70iqvt=cNQ@mail.gmail.com","threadId":"66665","inReplyTo":"xmqqcxsvkorm.fsf@gitster.g","subject":"Re: [Outreachy PATCH v2] t1402: test --no-allow-onelevel option precedence","fromName":"Fien Dora","fromEmail":"fiendora5@gmail.com","sentAt":"2026-10-28T20:22:18Z","receivedAt":"2026-10-28T20:22:18Z","isPatch":true,"sender":{"key":"fiendora5@gmail.com","avatar":null},"body":"> I haven't heard of anybody planning to do such a conversion, but do\n> you mean you are planning to do such a work as a follow-up?  If so,\n> write it more like \"I plan to do X in a separate series\".  If not,\n> please do not make up hallucinated facts.\n\nThank you, Junio.\n\nI apologise for presenting the possible conversion as though it were\nalready planned.\n\nI would be very interested in taking on the conversion of\ncheck-ref-format to parse_options() as a follow-up contribution.\nAlthough it would be a learning challenge for me, I am willing to\nstudy the existing implementation and work through it carefully.\n\nI would be grateful for your guidance on whether this would be a\nsuitable follow-up project and how best to approach it.\n\nIn the meantime, I will revise the current commit message to remove\nthe unsupported statement.\n\nThank you again for your guidance.\n\n"},{"id":"556770","messageId":"20261029121715.3845-1-fiendora5@gmail.com","threadId":"66665","inReplyTo":"20261027145451.8617-1-fiendora5@gmail.com","subject":"[Outreachy PATCH v3] t1402: test --no-allow-onelevel option precedence","fromName":"Fien Dora","fromEmail":"fiendora5@gmail.com","sentAt":"2026-10-29T12:17:15Z","receivedAt":"2026-10-29T12:17:15Z","isPatch":true,"sender":{"key":"fiendora5@gmail.com","avatar":null},"body":"Unlike most Git commands that use the parse_options() API,\ncheck-ref-format relies on a handcrafted loop to parse command-line\noptions. Although the --no- prefix is commonly used to negate options\nin Git, the precedence of --allow-onelevel and --no-allow-onelevel\nis not explicitly covered by the existing tests.\n\nAdd regression tests for both orders of --allow-onelevel and\n--no-allow-onelevel to verify that the last option takes precedence.\nThe tests confirm that --no-allow-onelevel overrides a preceding\n--allow-onelevel, and that --allow-onelevel similarly overrides a\npreceding --no-allow-onelevel.\n\nTo improve Git's command-line argument parsing, I plan to\nexplore converting check-ref-format's handcrafted parser to\nparse_options() API in a separate patch series. These tests\nestablish the current option-precedence behavior that the\nconversion would need to preserve.\n\nSigned-off-by: Fien Dora <fiendora5@gmail.com>\n---\n\nChanges since v2:\n- Clarify that converting check-ref-format to parse_options()\n  is work I plan to explore in a separate patch series, not\n  an existing Git development plan.\n- No changes to the tests.\n\n t/t1402-check-ref-format.sh | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh\nindex 9dd64662b2..6036df0210 100755\n--- a/t/t1402-check-ref-format.sh\n+++ b/t/t1402-check-ref-format.sh\n@@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern\n ref='foo'\n invalid_ref \"$ref\"\n valid_ref \"$ref\" --allow-onelevel\n+invalid_ref \"$ref\" '--allow-onelevel --no-allow-onelevel'\n+valid_ref \"$ref\" '--no-allow-onelevel --allow-onelevel'\n invalid_ref \"$ref\" --refspec-pattern\n valid_ref \"$ref\" '--refspec-pattern --allow-onelevel'\n invalid_ref \"$ref\" --normalize\n-- \n2.50.1 (Apple Git-155)\n\n\n"},{"id":"556818","messageId":"xmqqqzh81goi.fsf@gitster.g","threadId":"66665","inReplyTo":"20261029121715.3845-1-fiendora5@gmail.com","subject":"Re: [Outreachy PATCH v3] t1402: test --no-allow-onelevel option precedence","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-29T18:54:05Z","receivedAt":"2026-10-29T18:54:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fien Dora <fiendora5@gmail.com> writes:\n\n> Unlike most Git commands that use the parse_options() API,\n> check-ref-format relies on a handcrafted loop to parse command-line\n> options. Although the --no- prefix is commonly used to negate options\n> in Git, the precedence of --allow-onelevel and --no-allow-onelevel\n> is not explicitly covered by the existing tests.\n>\n> Add regression tests for both orders of --allow-onelevel and\n> --no-allow-onelevel to verify that the last option takes precedence.\n> The tests confirm that --no-allow-onelevel overrides a preceding\n> --allow-onelevel, and that --allow-onelevel similarly overrides a\n> preceding --no-allow-onelevel.\n>\n> To improve Git's command-line argument parsing, I plan to\n> explore converting check-ref-format's handcrafted parser to\n> parse_options() API in a separate patch series. These tests\n> establish the current option-precedence behavior that the\n> conversion would need to preserve.\n>\n> Signed-off-by: Fien Dora <fiendora5@gmail.com>\n> ---\n\nWell explained.\n\n> diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh\n> index 9dd64662b2..6036df0210 100755\n> --- a/t/t1402-check-ref-format.sh\n> +++ b/t/t1402-check-ref-format.sh\n> @@ -74,6 +74,8 @@ invalid_ref 'heads/foo*/bar*' --refspec-pattern\n>  ref='foo'\n>  invalid_ref \"$ref\"\n>  valid_ref \"$ref\" --allow-onelevel\n> +invalid_ref \"$ref\" '--allow-onelevel --no-allow-onelevel'\n> +valid_ref \"$ref\" '--no-allow-onelevel --allow-onelevel'\n>  invalid_ref \"$ref\" --refspec-pattern\n>  valid_ref \"$ref\" '--refspec-pattern --allow-onelevel'\n>  invalid_ref \"$ref\" --normalize\n\nWill queue.  Thanks.\n\n"}]}