{"thread":{"id":"66706","subject":"[PATCH] check-ref-format: use parse-options API","startedAt":"2026-10-29T18:33:27Z","lastAt":"2026-11-09T07:43:52Z","messageCount":6,"participants":["Husain Sitamuwala via GitGitGadget","Junio C Hamano","Karthik Nayak","Hussain Sitamouwala"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"556813","messageId":"pull.2470.git.git.1793298807397.gitgitgadget@gmail.com","threadId":"66706","inReplyTo":null,"subject":"[PATCH] check-ref-format: use parse-options API","fromName":"Husain Sitamuwala via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-29T18:33:27Z","receivedAt":"2026-10-29T18:33:27Z","isPatch":true,"sender":{"key":"name:Husain Sitamuwala","avatar":null},"body":"From: Hussain Sitamouwala <husainsitamuwala21@gmail.com>\n\nUse the parse-options API to handle command-line options\nconsistently with other Git builtins.\n\nThe command currently parses options manually, duplicating\nargument-handling logic. Using parse-options makes option\nhandling consistent with the rest of Git.\n\nReplace manual option parsing while preserving support for\nnormalization, branch names, and refname validation.\n\nSigned-off-by: Hussain Sitamouwala <husainsitamuwala21@gmail.com>\n---\n    check-ref-format: use parse-options API\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2470%2FCodeWithHusain%2Foutreachy-microproject-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2470/CodeWithHusain/outreachy-microproject-v1\nPull-Request: https://github.com/git/git/pull/2470\n\n builtin/check-ref-format.c | 45 ++++++++++++++++++++++++--------------\n 1 file changed, 28 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c\nindex fd1c9c0e0c..58e60eecd2 100644\n--- a/builtin/check-ref-format.c\n+++ b/builtin/check-ref-format.c\n@@ -5,13 +5,20 @@\n #define USE_THE_REPOSITORY_VARIABLE\n \n #include \"builtin.h\"\n+#include \"parse-options.h\"\n #include \"refs.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n \n static const char builtin_check_ref_format_usage[] =\n-\"git check-ref-format [--normalize] [<options>] <refname>\\n\"\n-\"   or: git check-ref-format --branch <branchname-shorthand>\";\n+\t\"git check-ref-format [--normalize] [<options>] <refname>\\n\"\n+\t\"   or: git check-ref-format --branch <branchname-shorthand>\";\n+\n+static const char * const builtin_check_ref_format_usages[] = {\n+\t\"git check-ref-format [--normalize] [<options>] <refname>\",\n+\t\"   or: git check-ref-format --branch <branchname-shorthand>\",\n+\tNULL\n+};\n \n /*\n  * Return a copy of refname but with leading slashes removed and runs\n@@ -58,13 +65,26 @@ int cmd_check_ref_format(int argc,\n \t\t\t const char *prefix,\n \t\t\t struct repository *repo UNUSED)\n {\n-\tint i;\n \tint normalize = 0;\n \tint flags = 0;\n \tconst char *refname;\n \tchar *to_free = NULL;\n \tint ret = 1;\n \n+\tstruct option options[] = {\n+\t\tOPT_BOOL(0, \"normalize\", &normalize,\n+\t\t\t N_(\"normalize refname\")),\n+\t\tOPT_BOOL(0, \"print\", &normalize,\n+\t\t\t N_(\"print normalized refname\")),\n+\t\tOPT_BIT(0, \"allow-onelevel\", &flags,\n+\t\t\tN_(\"allow one-level refnames\"),\n+\t\t\tREFNAME_ALLOW_ONELEVEL),\n+\t\tOPT_BIT(0, \"refspec-pattern\", &flags,\n+\t\t\tN_(\"allow refspec patterns\"),\n+\t\t\tREFNAME_REFSPEC_PATTERN),\n+\t\tOPT_END()\n+\t};\n+\n \tBUG_ON_NON_EMPTY_PREFIX(prefix);\n \n \tshow_usage_if_asked(argc, argv,\n@@ -73,22 +93,13 @@ int cmd_check_ref_format(int argc,\n \tif (argc == 3 && !strcmp(argv[1], \"--branch\"))\n \t\treturn check_ref_format_branch(argv[2]);\n \n-\tfor (i = 1; i < argc && argv[i][0] == '-'; i++) {\n-\t\tif (!strcmp(argv[i], \"--normalize\") || !strcmp(argv[i], \"--print\"))\n-\t\t\tnormalize = 1;\n-\t\telse if (!strcmp(argv[i], \"--allow-onelevel\"))\n-\t\t\tflags |= REFNAME_ALLOW_ONELEVEL;\n-\t\telse if (!strcmp(argv[i], \"--no-allow-onelevel\"))\n-\t\t\tflags &= ~REFNAME_ALLOW_ONELEVEL;\n-\t\telse if (!strcmp(argv[i], \"--refspec-pattern\"))\n-\t\t\tflags |= REFNAME_REFSPEC_PATTERN;\n-\t\telse\n-\t\t\tusage(builtin_check_ref_format_usage);\n-\t}\n-\tif (! (i == argc - 1))\n+\targc = parse_options(argc, argv, prefix, options,\n+\t\t\t     builtin_check_ref_format_usages, 0);\n+\n+\tif (argc != 1)\n \t\tusage(builtin_check_ref_format_usage);\n \n-\trefname = argv[i];\n+\trefname = argv[0];\n \tif (normalize)\n \t\trefname = to_free = collapse_slashes(refname);\n \tif (check_refname_format(refname, flags))\n\nbase-commit: 37b3475fb530c14109211faca33716a173db61ed\n-- \ngitgitgadget\n\n"},{"id":"556823","messageId":"xmqqh5i41d69.fsf@gitster.g","threadId":"66706","inReplyTo":"pull.2470.git.git.1793298807397.gitgitgadget@gmail.com","subject":"Re: [PATCH] check-ref-format: use parse-options API","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-29T20:09:50Z","receivedAt":"2026-10-29T20:09:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Husain Sitamuwala via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\nDidn't I read very recently that somebody else was updating\ncheck-ref-format?  Perhaps I am hallucinating.\n\nAnyway.\n\n>  static const char builtin_check_ref_format_usage[] =\n> -\"git check-ref-format [--normalize] [<options>] <refname>\\n\"\n> -\"   or: git check-ref-format --branch <branchname-shorthand>\";\n> +\t\"git check-ref-format [--normalize] [<options>] <refname>\\n\"\n> +\t\"   or: git check-ref-format --branch <branchname-shorthand>\";\n\nWhat is this change about?  More importantly, is it sensible to have\nthis and ...\n\n> +static const char * const builtin_check_ref_format_usages[] = {\n> +\t\"git check-ref-format [--normalize] [<options>] <refname>\",\n> +\t\"   or: git check-ref-format --branch <branchname-shorthand>\",\n> +\tNULL\n> +};\n\n... another variable with very similar and confusing name with very\nsimilar contents?  How do we plan to pay for the cost maintaining\nthem in sync?  Do we even need both of them?\n\n> @@ -58,13 +65,26 @@ int cmd_check_ref_format(int argc,\n>  \t\t\t const char *prefix,\n>  \t\t\t struct repository *repo UNUSED)\n>  {\n> -\tint i;\n>  \tint normalize = 0;\n>  \tint flags = 0;\n>  \tconst char *refname;\n>  \tchar *to_free = NULL;\n>  \tint ret = 1;\n>  \n> +\tstruct option options[] = {\n> +\t\tOPT_BOOL(0, \"normalize\", &normalize,\n> +\t\t\t N_(\"normalize refname\")),\n> +\t\tOPT_BOOL(0, \"print\", &normalize,\n> +\t\t\t N_(\"print normalized refname\")),\n\nAs can be seen in the usage string and in the \"git blame\" output for\nthe code before this patch to parse \"--print\", which points at\na40e6fb67a (Change check_refname_format() to reject unnormalized\nrefnames, 2011-09-15), we still accept \"--print\" as a deprecated\nsynonym but we do not advertise it.  A good candidate for using\nPARSE_OPT_HIDDEN, probably.\n\n> +\t\tOPT_BIT(0, \"allow-onelevel\", &flags,\n> +\t\t\tN_(\"allow one-level refnames\"),\n> +\t\t\tREFNAME_ALLOW_ONELEVEL),\n> +\t\tOPT_BIT(0, \"refspec-pattern\", &flags,\n> +\t\t\tN_(\"allow refspec patterns\"),\n> +\t\t\tREFNAME_REFSPEC_PATTERN),\n> +\t\tOPT_END()\n> +\t};\n\nDo we want to barf when the user says\n\n    $ git check-ref-format --no-print --no-normalize --no-refspec-pattern ...\n\nby the way?  With the above, we suddenly start taking these options,\nand I offhand do not know what the ramifications of doing so are.\n\n>  \tBUG_ON_NON_EMPTY_PREFIX(prefix);\n>  \n>  \tshow_usage_if_asked(argc, argv,\n\nThe call to show_usage_if_asked() is still here, which means\n\n    $ git check-ref-format -h\n\nis intercepted by this call and the control will never come back.\n\nWe will never reach parse_options() call below, so you lose 80% of\nthe value of using parse-options API, which is that you get the list\nof options and its descriptions for free (well not free, you\ncarefully prepared them in the option[] array above, and they are\nwasted).\n\n> @@ -73,22 +93,13 @@ int cmd_check_ref_format(int argc,\n>  \tif (argc == 3 && !strcmp(argv[1], \"--branch\"))\n>  \t\treturn check_ref_format_branch(argv[2]);\n>  \n> -\tfor (i = 1; i < argc && argv[i][0] == '-'; i++) {\n> -\t\tif (!strcmp(argv[i], \"--normalize\") || !strcmp(argv[i], \"--print\"))\n> -\t\t\tnormalize = 1;\n> -\t\telse if (!strcmp(argv[i], \"--allow-onelevel\"))\n> -\t\t\tflags |= REFNAME_ALLOW_ONELEVEL;\n> -\t\telse if (!strcmp(argv[i], \"--no-allow-onelevel\"))\n> -\t\t\tflags &= ~REFNAME_ALLOW_ONELEVEL;\n> -\t\telse if (!strcmp(argv[i], \"--refspec-pattern\"))\n> -\t\t\tflags |= REFNAME_REFSPEC_PATTERN;\n> -\t\telse\n> -\t\t\tusage(builtin_check_ref_format_usage);\n> -\t}\n> -\tif (! (i == argc - 1))\n> +\targc = parse_options(argc, argv, prefix, options,\n> +\t\t\t     builtin_check_ref_format_usages, 0);\n> +\n> +\tif (argc != 1)\n>  \t\tusage(builtin_check_ref_format_usage);\n>  \n> -\trefname = argv[i];\n> +\trefname = argv[0];\n>  \tif (normalize)\n>  \t\trefname = to_free = collapse_slashes(refname);\n>  \tif (check_refname_format(refname, flags))\n>\n> base-commit: 37b3475fb530c14109211faca33716a173db61ed\n\n"},{"id":"557275","messageId":"pull.2470.v2.git.git.1793694813386.gitgitgadget@gmail.com","threadId":"66706","inReplyTo":"pull.2470.git.git.1793298807397.gitgitgadget@gmail.com","subject":"[PATCH v2] check-ref-format: use parse-options API","fromName":"Husain Sitamuwala via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-11-03T08:33:33Z","receivedAt":"2026-11-03T08:33:33Z","isPatch":true,"sender":{"key":"name:Husain Sitamuwala","avatar":null},"body":"From: Hussain Sitamouwala <husainsitamuwala21@gmail.com>\n\nThe command parses its options by hand, comparing each argument\nagainst string literals. Use the parse-options API instead so that\noption handling is consistent with other builtins and the help\noutput is generated from the option table.\n\nKeep the existing behavior: --print stays a hidden, deprecated\nsynonym for --normalize, only --allow-onelevel can be negated, and\nparsing stops at the first non-option argument so that options\nafter <refname> are still rejected.\n\nDrop the early show_usage_if_asked() call, so that -h is handled by\nparse_options().\n\nTwo minor differences come with parse_options(): unambiguous\nabbreviations of long options, such as --norm, are accepted, and\n\"--\" may now precede <refname>.\n\nSigned-off-by: Hussain Sitamouwala <husainsitamuwala21@gmail.com>\n---\n    check-ref-format: use parse-options API\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2470%2FCodeWithHusain%2Foutreachy-microproject-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2470/CodeWithHusain/outreachy-microproject-v2\nPull-Request: https://github.com/git/git/pull/2470\n\nRange-diff vs v1:\n\n 1:  9f05296454 ! 1:  991ca870fe check-ref-format: use parse-options API\n     @@ Metadata\n       ## Commit message ##\n          check-ref-format: use parse-options API\n      \n     -    Use the parse-options API to handle command-line options\n     -    consistently with other Git builtins.\n     +    The command parses its options by hand, comparing each argument\n     +    against string literals. Use the parse-options API instead so that\n     +    option handling is consistent with other builtins and the help\n     +    output is generated from the option table.\n      \n     -    The command currently parses options manually, duplicating\n     -    argument-handling logic. Using parse-options makes option\n     -    handling consistent with the rest of Git.\n     +    Keep the existing behavior: --print stays a hidden, deprecated\n     +    synonym for --normalize, only --allow-onelevel can be negated, and\n     +    parsing stops at the first non-option argument so that options\n     +    after <refname> are still rejected.\n      \n     -    Replace manual option parsing while preserving support for\n     -    normalization, branch names, and refname validation.\n     +    Drop the early show_usage_if_asked() call, so that -h is handled by\n     +    parse_options().\n     +\n     +    Two minor differences come with parse_options(): unambiguous\n     +    abbreviations of long options, such as --norm, are accepted, and\n     +    \"--\" may now precede <refname>.\n      \n          Signed-off-by: Hussain Sitamouwala <husainsitamuwala21@gmail.com>\n      \n     @@ builtin/check-ref-format.c\n       #include \"setup.h\"\n       #include \"strbuf.h\"\n       \n     - static const char builtin_check_ref_format_usage[] =\n     +-static const char builtin_check_ref_format_usage[] =\n      -\"git check-ref-format [--normalize] [<options>] <refname>\\n\"\n      -\"   or: git check-ref-format --branch <branchname-shorthand>\";\n     -+\t\"git check-ref-format [--normalize] [<options>] <refname>\\n\"\n     -+\t\"   or: git check-ref-format --branch <branchname-shorthand>\";\n     -+\n     -+static const char * const builtin_check_ref_format_usages[] = {\n     -+\t\"git check-ref-format [--normalize] [<options>] <refname>\",\n     -+\t\"   or: git check-ref-format --branch <branchname-shorthand>\",\n     ++static const char * const builtin_check_ref_format_usage[] = {\n     ++\tN_(\"git check-ref-format [--normalize] [<options>] <refname>\"),\n     ++\tN_(\"git check-ref-format --branch <branchname-shorthand>\"),\n      +\tNULL\n      +};\n       \n     @@ builtin/check-ref-format.c: int cmd_check_ref_format(int argc,\n       \tconst char *refname;\n       \tchar *to_free = NULL;\n       \tint ret = 1;\n     - \n      +\tstruct option options[] = {\n     -+\t\tOPT_BOOL(0, \"normalize\", &normalize,\n     -+\t\t\t N_(\"normalize refname\")),\n     -+\t\tOPT_BOOL(0, \"print\", &normalize,\n     -+\t\t\t N_(\"print normalized refname\")),\n     ++\t\tOPT_BOOL_F(0, \"normalize\", &normalize,\n     ++\t\t\t   N_(\"normalize the refname and print it\"),\n     ++\t\t\t   PARSE_OPT_NONEG),\n     ++\t\tOPT_BOOL_F(0, \"print\", &normalize,\n     ++\t\t\t   N_(\"deprecated synonym for --normalize\"),\n     ++\t\t\t   PARSE_OPT_NONEG | PARSE_OPT_HIDDEN),\n      +\t\tOPT_BIT(0, \"allow-onelevel\", &flags,\n     -+\t\t\tN_(\"allow one-level refnames\"),\n     ++\t\t\tN_(\"accept a refname with a single level\"),\n      +\t\t\tREFNAME_ALLOW_ONELEVEL),\n     -+\t\tOPT_BIT(0, \"refspec-pattern\", &flags,\n     -+\t\t\tN_(\"allow refspec patterns\"),\n     -+\t\t\tREFNAME_REFSPEC_PATTERN),\n     ++\t\tOPT_BIT_F(0, \"refspec-pattern\", &flags,\n     ++\t\t\t  N_(\"interpret <refname> as a reference pattern for a refspec\"),\n     ++\t\t\t  REFNAME_REFSPEC_PATTERN, PARSE_OPT_NONEG),\n      +\t\tOPT_END()\n      +\t};\n     -+\n     + \n       \tBUG_ON_NON_EMPTY_PREFIX(prefix);\n       \n     - \tshow_usage_if_asked(argc, argv,\n     -@@ builtin/check-ref-format.c: int cmd_check_ref_format(int argc,\n     +-\tshow_usage_if_asked(argc, argv,\n     +-\t\t\t    builtin_check_ref_format_usage);\n     +-\n       \tif (argc == 3 && !strcmp(argv[1], \"--branch\"))\n       \t\treturn check_ref_format_branch(argv[2]);\n       \n     @@ builtin/check-ref-format.c: int cmd_check_ref_format(int argc,\n      -\t\t\tusage(builtin_check_ref_format_usage);\n      -\t}\n      -\tif (! (i == argc - 1))\n     +-\t\tusage(builtin_check_ref_format_usage);\n      +\targc = parse_options(argc, argv, prefix, options,\n     -+\t\t\t     builtin_check_ref_format_usages, 0);\n     -+\n     ++\t\t\t     builtin_check_ref_format_usage,\n     ++\t\t\t     PARSE_OPT_STOP_AT_NON_OPTION);\n      +\tif (argc != 1)\n     - \t\tusage(builtin_check_ref_format_usage);\n     ++\t\tusage_with_options(builtin_check_ref_format_usage, options);\n       \n      -\trefname = argv[i];\n      +\trefname = argv[0];\n\n\n builtin/check-ref-format.c | 49 +++++++++++++++++++++-----------------\n 1 file changed, 27 insertions(+), 22 deletions(-)\n\ndiff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c\nindex fd1c9c0e0c..d698da99d9 100644\n--- a/builtin/check-ref-format.c\n+++ b/builtin/check-ref-format.c\n@@ -5,13 +5,16 @@\n #define USE_THE_REPOSITORY_VARIABLE\n \n #include \"builtin.h\"\n+#include \"parse-options.h\"\n #include \"refs.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n \n-static const char builtin_check_ref_format_usage[] =\n-\"git check-ref-format [--normalize] [<options>] <refname>\\n\"\n-\"   or: git check-ref-format --branch <branchname-shorthand>\";\n+static const char * const builtin_check_ref_format_usage[] = {\n+\tN_(\"git check-ref-format [--normalize] [<options>] <refname>\"),\n+\tN_(\"git check-ref-format --branch <branchname-shorthand>\"),\n+\tNULL\n+};\n \n /*\n  * Return a copy of refname but with leading slashes removed and runs\n@@ -58,37 +61,39 @@ int cmd_check_ref_format(int argc,\n \t\t\t const char *prefix,\n \t\t\t struct repository *repo UNUSED)\n {\n-\tint i;\n \tint normalize = 0;\n \tint flags = 0;\n \tconst char *refname;\n \tchar *to_free = NULL;\n \tint ret = 1;\n+\tstruct option options[] = {\n+\t\tOPT_BOOL_F(0, \"normalize\", &normalize,\n+\t\t\t   N_(\"normalize the refname and print it\"),\n+\t\t\t   PARSE_OPT_NONEG),\n+\t\tOPT_BOOL_F(0, \"print\", &normalize,\n+\t\t\t   N_(\"deprecated synonym for --normalize\"),\n+\t\t\t   PARSE_OPT_NONEG | PARSE_OPT_HIDDEN),\n+\t\tOPT_BIT(0, \"allow-onelevel\", &flags,\n+\t\t\tN_(\"accept a refname with a single level\"),\n+\t\t\tREFNAME_ALLOW_ONELEVEL),\n+\t\tOPT_BIT_F(0, \"refspec-pattern\", &flags,\n+\t\t\t  N_(\"interpret <refname> as a reference pattern for a refspec\"),\n+\t\t\t  REFNAME_REFSPEC_PATTERN, PARSE_OPT_NONEG),\n+\t\tOPT_END()\n+\t};\n \n \tBUG_ON_NON_EMPTY_PREFIX(prefix);\n \n-\tshow_usage_if_asked(argc, argv,\n-\t\t\t    builtin_check_ref_format_usage);\n-\n \tif (argc == 3 && !strcmp(argv[1], \"--branch\"))\n \t\treturn check_ref_format_branch(argv[2]);\n \n-\tfor (i = 1; i < argc && argv[i][0] == '-'; i++) {\n-\t\tif (!strcmp(argv[i], \"--normalize\") || !strcmp(argv[i], \"--print\"))\n-\t\t\tnormalize = 1;\n-\t\telse if (!strcmp(argv[i], \"--allow-onelevel\"))\n-\t\t\tflags |= REFNAME_ALLOW_ONELEVEL;\n-\t\telse if (!strcmp(argv[i], \"--no-allow-onelevel\"))\n-\t\t\tflags &= ~REFNAME_ALLOW_ONELEVEL;\n-\t\telse if (!strcmp(argv[i], \"--refspec-pattern\"))\n-\t\t\tflags |= REFNAME_REFSPEC_PATTERN;\n-\t\telse\n-\t\t\tusage(builtin_check_ref_format_usage);\n-\t}\n-\tif (! (i == argc - 1))\n-\t\tusage(builtin_check_ref_format_usage);\n+\targc = parse_options(argc, argv, prefix, options,\n+\t\t\t     builtin_check_ref_format_usage,\n+\t\t\t     PARSE_OPT_STOP_AT_NON_OPTION);\n+\tif (argc != 1)\n+\t\tusage_with_options(builtin_check_ref_format_usage, options);\n \n-\trefname = argv[i];\n+\trefname = argv[0];\n \tif (normalize)\n \t\trefname = to_free = collapse_slashes(refname);\n \tif (check_refname_format(refname, flags))\n\nbase-commit: b9e5cff1803ab24582201ef059516eb16014b9d9\n-- \ngitgitgadget\n\n"},{"id":"557284","messageId":"CAOLa=ZS3ULcNVjV1DMO-iB+LcC2Gnw+9oU2_7VXKoLvgiVRnbg@mail.gmail.com","threadId":"66706","inReplyTo":"pull.2470.v2.git.git.1793694813386.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] check-ref-format: use parse-options API","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2026-11-03T10:00:59Z","receivedAt":"2026-11-03T10:00:59Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\"Husain Sitamuwala via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Hussain Sitamouwala <husainsitamuwala21@gmail.com>\n>\n> The command parses its options by hand, comparing each argument\n> against string literals. Use the parse-options API instead so that\n> option handling is consistent with other builtins and the help\n> output is generated from the option table.\n>\n> Keep the existing behavior: --print stays a hidden, deprecated\n> synonym for --normalize, only --allow-onelevel can be negated, and\n> parsing stops at the first non-option argument so that options\n> after <refname> are still rejected.\n>\n> Drop the early show_usage_if_asked() call, so that -h is handled by\n> parse_options().\n>\n> Two minor differences come with parse_options(): unambiguous\n> abbreviations of long options, such as --norm, are accepted, and\n> \"--\" may now precede <refname>.\n>\n\nIf you follow our 'Documentation/SubmittingPatches' guidelines, it\nstates:\n\n  It is often beneficial to allow some time for reviewers to provide\n  feedback before sending a new version, rather than sending an updated\n  series immediately after receiving a review. This helps collect\n  broader input, gives reviewers in different time zones a fair chance\n  to comment, and avoids unnecessary churn from many rapid iterations.\n  Waiting also encourages you to polish each version before sending it,\n  so reviewers can focus on substantial issues rather than typos or\n  other small mistakes.\n\nSeems like Junio's review went unanswered. Which makes it hard for me to\nconsider dedicating time to do another review of the newer version. I\nwould suggest that you engage in the process before sending new\nversions. I'll hold off reviewing till then :)\n\n[snip]\n"},{"id":"557350","messageId":"xmqq33th92hu.fsf@gitster.g","threadId":"66706","inReplyTo":"CAOLa=ZS3ULcNVjV1DMO-iB+LcC2Gnw+9oU2_7VXKoLvgiVRnbg@mail.gmail.com","subject":"Re: [PATCH v2] check-ref-format: use parse-options API","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-11-03T18:46:53Z","receivedAt":"2026-11-03T18:46:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> If you follow our 'Documentation/SubmittingPatches' guidelines, it\n> states:\n>\n>   It is often beneficial to allow some time for reviewers to provide\n>   feedback before sending a new version, rather than sending an updated\n>   series immediately after receiving a review. This helps collect\n>   broader input, gives reviewers in different time zones a fair chance\n>   to comment, and avoids unnecessary churn from many rapid iterations.\n>   Waiting also encourages you to polish each version before sending it,\n>   so reviewers can focus on substantial issues rather than typos or\n>   other small mistakes.\n\nThanks for bringing it up.  Also MyFirstContribution has this:\n\n    After a few days, you may receive comments on your patch series.\n    Carefully read them to understand the reviewers' perspective, and do\n    not hesitate to ask for clarification.\n\n    Reviewers may also ask about your proposed commit log or the changes.\n    Answer these in your response.  They often ask because the patch needs\n    clarification; use this feedback to improve your writing, and update\n    the patch so the next reader does not have to ask the same question.\n\n    Do not start coding, much less send the next version, until you finish\n    discussing the current one and both sides know what to expect.  This\n    saves time, lets reviewers respond before you write a patch they have\n    to reject, and avoids forcing them to inspect 'v2' only to find their\n    concerns unaddressed.\n\n"},{"id":"557883","messageId":"20261109074352.163019-1-husainsitamuwala21@gmail.com","threadId":"66706","inReplyTo":"CAOLa=ZS3ULcNVjV1DMO-iB+LcC2Gnw+9oU2_7VXKoLvgiVRnbg@mail.gmail.com","subject":"Re: [PATCH v2] check-ref-format: use parse-options API","fromName":"Hussain Sitamouwala","fromEmail":"husainsitamuwala21@gmail.com","sentAt":"2026-11-09T07:43:52Z","receivedAt":"2026-11-09T07:43:52Z","isPatch":true,"sender":{"key":"husainsitamuwala21@gmail.com","avatar":null},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> Seems like Junio's review went unanswered. Which makes it hard for me\n> to consider dedicating time to do another review of the newer version.\n\nHi Karthik, Junio,\n\nSorry about that. I sent v2 before replying to Junio's review of v1,\nand I should have discussed it first. I have now re-read\nDocumentation/SubmittingPatches and MyFirstContribution, and I will\nwait for feedback before sending any further version.\n\n> What is this change about?  More importantly, is it sensible to have\n> this and ... another variable with very similar and confusing name\n\nYou are right, keeping two usage variables in sync made no sense. v2\nhas a single builtin_check_ref_format_usage[] array, and\nusage_with_options() is used for the error path, so the old string\nis gone.\n\n> As can be seen in the usage string ... we still accept \"--print\" as\n> a deprecated synonym but we do not advertise it.\n\nIn v2, --print is marked PARSE_OPT_HIDDEN and its help text says it\nis a deprecated synonym for --normalize.\n\n> Do we want to barf when the user says\n>\n>     $ git check-ref-format --no-print --no-normalize\n>       --no-refspec-pattern ...\n\nNo. v2 adds PARSE_OPT_NONEG to --normalize, --print and\n--refspec-pattern. Only --no-allow-onelevel is still accepted, as\nbefore, so the set of accepted options is unchanged.\n\n> The call to show_usage_if_asked() is still here, which means\n> \"git check-ref-format -h\" is intercepted ...\n\nv2 drops that call, so \"-h\" now goes through parse_options() and the\noption list is generated from the table.\n\nI also used PARSE_OPT_STOP_AT_NON_OPTION so that options placed after\n<refname> are still rejected, as they were before.\n\nTwo behavior differences come with parse_options(), both mentioned in\nthe commit message: unambiguous abbreviations such as --norm are now\naccepted, and \"--\" may now precede <refname>. If either is unwanted,\nI am happy to change it. I ran t1402-check-ref-format.sh and it passes.\n\nI will wait for further comments before preparing v3.\n\nThanks,\nHussain Sitamouwala\n\n"}]}