{"thread":{"id":"65338","subject":"[PATCH] repo: show subcommand-specific help text","startedAt":"2026-03-23T15:29:43Z","lastAt":"2026-03-25T16:55:11Z","messageCount":10,"participants":["Mahi Kassa","Derrick Stolee","Patrick Steinhardt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"539749","messageId":"20260323152937.257406-1-mahlet.takassa@gmail.com","threadId":"65338","inReplyTo":null,"subject":"[PATCH] repo: show subcommand-specific help text","fromName":"Mahi Kassa","fromEmail":"mahlet.takassa@gmail.com","sentAt":"2026-03-23T15:29:37Z","receivedAt":"2026-03-23T15:29:43Z","isPatch":true,"body":"Use subcommand-specific usage arrays for \"git repo info\" and \"git repo structure\" so that each command shows only its own synopsis in help output.\n\nKeep the top-level \"git repo -h\" output unchanged, and add tests to cover the subcommand help behavior.\n---\n builtin/repo.c            | 15 +++++++++++++--\n t/t1900-repo-info.sh      |  6 +++++-\n t/t1901-repo-structure.sh |  5 +++++\n 3 files changed, 23 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/repo.c b/builtin/repo.c\nindex 55f9b9095c..5ccc5c401a 100644\n--- a/builtin/repo.c\n+++ b/builtin/repo.c\n@@ -27,6 +27,17 @@ static const char *const repo_usage[] = {\n \tNULL\n };\n \n+static const char *const repo_info_usage[] = {\n+\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n+\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n+\tNULL\n+};\n+\n+static const char *const repo_structure_usage[] = {\n+\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n+\tNULL\n+};\n+\n typedef int get_value_fn(struct repository *repo, struct strbuf *buf);\n \n enum output_format {\n@@ -214,7 +225,7 @@ static int cmd_repo_info(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n+\targc = parse_options(argc, argv, prefix, options, repo_info_usage, 0);\n \n \tif (show_keys && (all_keys || argc))\n \t\tdie(_(\"--keys cannot be used with a <key> or --all\"));\n@@ -879,7 +890,7 @@ static int cmd_repo_structure(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n+\targc = parse_options(argc, argv, prefix, options, repo_structure_usage, 0);\n \tif (argc)\n \t\tusage(_(\"too many arguments\"));\n \ndiff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh\nindex a9eb07abe8..e0e79ff167 100755\n--- a/t/t1900-repo-info.sh\n+++ b/t/t1900-repo-info.sh\n@@ -148,5 +148,9 @@ test_expect_success 'git repo info --keys uses lines as its default output forma\n \tgit repo info --keys >actual &&\n \ttest_cmp expect actual\n '\n-\n+test_expect_success 'git repo info -h shows only repo info usage' '\n+\ttest_must_fail git repo info -h >actual &&\n+\ttest_grep \"git repo info\" actual &&\n+\ttest_grep ! \"git repo structure\" actual\n+'\n test_done\ndiff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh\nindex 98921ce1cb..0f7ec4da10 100755\n--- a/t/t1901-repo-structure.sh\n+++ b/t/t1901-repo-structure.sh\n@@ -224,4 +224,9 @@ test_expect_success 'progress meter option' '\n \t)\n '\n \n+test_expect_success 'git repo structure -h shows only repo structure usage' '\n+\ttest_must_fail git repo structure -h >actual &&\n+\ttest_grep \"git repo structure\" actual &&\n+\ttest_grep ! \"git repo info\" actual\n+'\n test_done\n-- \n2.34.1\n\n"},{"id":"539776","messageId":"ab38c06c-29de-4c41-9aeb-5e465f6af532@gmail.com","threadId":"65338","inReplyTo":"20260323152937.257406-1-mahlet.takassa@gmail.com","subject":"Re: [PATCH] repo: show subcommand-specific help text","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2026-03-23T19:32:44Z","receivedAt":"2026-03-23T19:32:47Z","isPatch":true,"body":"On 3/23/2026 11:29 AM, Mahi Kassa wrote:\n> Use subcommand-specific usage arrays for \"git repo info\" and \"git repo structure\" so that each command shows only its own synopsis in help output.\n> \n> Keep the top-level \"git repo -h\" output unchanged, and add tests to cover the subcommand help behavior.\n\nPlease wrap your lines in the commit message.\n\n> +static const char *const repo_info_usage[] = {\n> +\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n> +\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n> +\tNULL\n> +};\n> +\n> +static const char *const repo_structure_usage[] = {\n> +\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n> +\tNULL\n> +};\n> +\n\nI did a visual comparison to the synopsis in Documentation/git-repo.adoc\n[1] and these look the same. (I suspect that they also exist in the\nrepo_usage struct outside of the patch context, so they were easy to\ncopy from there.)\n\n[1] https://github.com/git/git/blob/6e8d538aab8fe4dd07ba9fb87b5c7edcfa5706ad/Documentation/git-repo.adoc?plain=1#L10-L13\n\n> -\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n> +\targc = parse_options(argc, argv, prefix, options, repo_info_usage, 0);\n\n> -\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n> +\targc = parse_options(argc, argv, prefix, options, repo_structure_usage, 0);\n\nNice and easy here.\n\n> --- a/t/t1900-repo-info.sh\n> +++ b/t/t1900-repo-info.sh\n> @@ -148,5 +148,9 @@ test_expect_success 'git repo info --keys uses lines as its default output forma\n>  \tgit repo info --keys >actual &&\n>  \ttest_cmp expect actual\n>  '\n> -\n\nDon't erase the whitespace between tests.\n\n> +test_expect_success 'git repo info -h shows only repo info usage' '\n> +\ttest_must_fail git repo info -h >actual &&\n> +\ttest_grep \"git repo info\" actual &&\n> +\ttest_grep ! \"git repo structure\" actual\n> +'\n>  test_done\n\nand keep whitespace between the end of the test and 'test_done'.\n\n> diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh\n> index 98921ce1cb..0f7ec4da10 100755\n> --- a/t/t1901-repo-structure.sh\n> +++ b/t/t1901-repo-structure.sh\n> @@ -224,4 +224,9 @@ test_expect_success 'progress meter option' '\n>  \t)\n>  '\n>  \n> +test_expect_success 'git repo structure -h shows only repo structure usage' '\n\nYou preserved the whitespace above this test. good.\n\n> +\ttest_must_fail git repo structure -h >actual &&\n> +\ttest_grep \"git repo structure\" actual &&\n> +\ttest_grep ! \"git repo info\" actual\n> +'\n>  test_done\n\nBut here we need some before 'test_done'.\n\nThanks,\n-Stolee\n\n"},{"id":"539807","messageId":"acIujxB3kod2VYfB@pks.im","threadId":"65338","inReplyTo":"20260323152937.257406-1-mahlet.takassa@gmail.com","subject":"Re: [PATCH] repo: show subcommand-specific help text","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-24T06:26:23Z","receivedAt":"2026-03-24T06:26:29Z","isPatch":true,"body":"On Mon, Mar 23, 2026 at 04:29:37PM +0100, Mahi Kassa wrote:\n> diff --git a/builtin/repo.c b/builtin/repo.c\n> index 55f9b9095c..5ccc5c401a 100644\n> --- a/builtin/repo.c\n> +++ b/builtin/repo.c\n> @@ -27,6 +27,17 @@ static const char *const repo_usage[] = {\n>  \tNULL\n>  };\n>  \n> +static const char *const repo_info_usage[] = {\n> +\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n> +\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n> +\tNULL\n> +};\n> +\n> +static const char *const repo_structure_usage[] = {\n> +\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n> +\tNULL\n> +};\n> +\n>  typedef int get_value_fn(struct repository *repo, struct strbuf *buf);\n>  \n>  enum output_format {\n\nThese are basically the split-out parts of `repo_usage`, which makes\nsense. But it also means that it will be quite easy for those two usages\nto diverge over time. Would it make sense to maybe split the individual\nusage strings into macros that we can reuse? Something like the below\n(partial) patch.\n\nThanks!\n\nPatrick\n\ndiff --git a/builtin/repo.c b/builtin/repo.c\nindex 55f9b9095c..200c5901a7 100644\n--- a/builtin/repo.c\n+++ b/builtin/repo.c\n@@ -20,11 +20,22 @@\n #include \"tree-walk.h\"\n #include \"utf8.h\"\n \n+#define REPO_INFO_USAGE \\\n+\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\", \\\n+\t\"git repo info --keys [--format=(lines|nul) | -z]\"\n+\n+#define REPO_STRUCTURE_USAGE \\\n+\t\"git repo structure [--format=(table|lines|nul) | -z]\"\n+\n static const char *const repo_usage[] = {\n-\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n-\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n-\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n-\tNULL\n+\tREPO_INFO_USAGE,\n+\tREPO_STRUCTURE_USAGE,\n+\tNULL,\n+};\n+\n+static const char *const repo_info_usage[] = {\n+\tREPO_INFO_USAGE,\n+\tNULL,\n };\n \n typedef int get_value_fn(struct repository *repo, struct strbuf *buf);\n@@ -214,7 +225,7 @@ static int cmd_repo_info(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n+\targc = parse_options(argc, argv, prefix, options, repo_info_usage, 0);\n \n \tif (show_keys && (all_keys || argc))\n \t\tdie(_(\"--keys cannot be used with a <key> or --all\"));\n"},{"id":"539830","messageId":"20260324122111.84122-1-mahlet.takassa@gmail.com","threadId":"65338","inReplyTo":"20260323152937.257406-1-mahlet.takassa@gmail.com","subject":"[PATCH v2] repo: show subcommand-specific help text","fromName":"Mahi Kassa","fromEmail":"mahlet.takassa@gmail.com","sentAt":"2026-03-24T12:21:11Z","receivedAt":"2026-03-24T12:23:43Z","isPatch":true,"body":"Use subcommand-specific usage arrays for \"git repo info\" and\n\"git repo structure\" so that each command shows only its own\nsynopsis in help output.\n\nFactor the shared usage strings into macros to avoid\nduplicating the same synopsis text in multiple arrays.\n\nAdd tests to cover the subcommand help behavior.\n\n---\nv2:\n- wrap commit message lines\n- factor shared usage strings into macros to avoid duplication\n- restore blank lines between tests and before test_done\n\n builtin/repo.c            | 15 +++++++++++++--\n t/t1900-repo-info.sh      |  6 +++++-\n t/t1901-repo-structure.sh |  5 +++++\n 3 files changed, 23 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/repo.c b/builtin/repo.c\nindex 55f9b9095c..5ccc5c401a 100644\n--- a/builtin/repo.c\n+++ b/builtin/repo.c\n@@ -27,6 +27,17 @@ static const char *const repo_usage[] = {\n \tNULL\n };\n \n+static const char *const repo_info_usage[] = {\n+\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n+\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n+\tNULL\n+};\n+\n+static const char *const repo_structure_usage[] = {\n+\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n+\tNULL\n+};\n+\n typedef int get_value_fn(struct repository *repo, struct strbuf *buf);\n \n enum output_format {\n@@ -214,7 +225,7 @@ static int cmd_repo_info(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n+\targc = parse_options(argc, argv, prefix, options, repo_info_usage, 0);\n \n \tif (show_keys && (all_keys || argc))\n \t\tdie(_(\"--keys cannot be used with a <key> or --all\"));\n@@ -879,7 +890,7 @@ static int cmd_repo_structure(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n+\targc = parse_options(argc, argv, prefix, options, repo_structure_usage, 0);\n \tif (argc)\n \t\tusage(_(\"too many arguments\"));\n \ndiff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh\nindex a9eb07abe8..e0e79ff167 100755\n--- a/t/t1900-repo-info.sh\n+++ b/t/t1900-repo-info.sh\n@@ -148,5 +148,9 @@ test_expect_success 'git repo info --keys uses lines as its default output forma\n \tgit repo info --keys >actual &&\n \ttest_cmp expect actual\n '\n-\n+test_expect_success 'git repo info -h shows only repo info usage' '\n+\ttest_must_fail git repo info -h >actual &&\n+\ttest_grep \"git repo info\" actual &&\n+\ttest_grep ! \"git repo structure\" actual\n+'\n test_done\ndiff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh\nindex 98921ce1cb..0f7ec4da10 100755\n--- a/t/t1901-repo-structure.sh\n+++ b/t/t1901-repo-structure.sh\n@@ -224,4 +224,9 @@ test_expect_success 'progress meter option' '\n \t)\n '\n \n+test_expect_success 'git repo structure -h shows only repo structure usage' '\n+\ttest_must_fail git repo structure -h >actual &&\n+\ttest_grep \"git repo structure\" actual &&\n+\ttest_grep ! \"git repo info\" actual\n+'\n test_done\n-- \n2.34.1\n\n"},{"id":"539841","messageId":"acKJFZiDg88fON4W@pks.im","threadId":"65338","inReplyTo":"20260324122111.84122-1-mahlet.takassa@gmail.com","subject":"Re: [PATCH v2] repo: show subcommand-specific help text","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-24T12:52:37Z","receivedAt":"2026-03-24T12:52:43Z","isPatch":true,"body":"On Tue, Mar 24, 2026 at 01:21:11PM +0100, Mahi Kassa wrote:\n> Use subcommand-specific usage arrays for \"git repo info\" and\n> \"git repo structure\" so that each command shows only its own\n> synopsis in help output.\n> \n> Factor the shared usage strings into macros to avoid\n> duplicating the same synopsis text in multiple arrays.\n> \n> Add tests to cover the subcommand help behavior.\n> \n> ---\n> v2:\n> - wrap commit message lines\n> - factor shared usage strings into macros to avoid duplication\n> - restore blank lines between tests and before test_done\n\nSomething most have gone wrong, as I cannot see any of the macros. We\nstill duplicate the usage strings.\n\nPatrick\n\n> diff --git a/builtin/repo.c b/builtin/repo.c\n> index 55f9b9095c..5ccc5c401a 100644\n> --- a/builtin/repo.c\n> +++ b/builtin/repo.c\n> @@ -27,6 +27,17 @@ static const char *const repo_usage[] = {\n>  \tNULL\n>  };\n>  \n> +static const char *const repo_info_usage[] = {\n> +\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n> +\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n> +\tNULL\n> +};\n> +\n> +static const char *const repo_structure_usage[] = {\n> +\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n> +\tNULL\n> +};\n> +\n>  typedef int get_value_fn(struct repository *repo, struct strbuf *buf);\n>  \n>  enum output_format {\n"},{"id":"539858","messageId":"52a72fe5-d86d-4f06-bd08-5bbfd1faa78e@gmail.com","threadId":"65338","inReplyTo":"20260324122111.84122-1-mahlet.takassa@gmail.com","subject":"Re: [PATCH v2] repo: show subcommand-specific help text","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2026-03-24T17:07:19Z","receivedAt":"2026-03-24T17:07:25Z","isPatch":true,"body":"On 3/24/2026 8:21 AM, Mahi Kassa wrote:\n> Use subcommand-specific usage arrays for \"git repo info\" and\n> \"git repo structure\" so that each command shows only its own\n> synopsis in help output.\n> \n> Factor the shared usage strings into macros to avoid\n> duplicating the same synopsis text in multiple arrays.\n> \n> Add tests to cover the subcommand help behavior.\n\nMissing sign-off.\n\n> @@ -148,5 +148,9 @@ test_expect_success 'git repo info --keys uses lines as its default output forma\n>  \tgit repo info --keys >actual &&\n>  \ttest_cmp expect actual\n>  '\n> -\n> +test_expect_success 'git repo info -h shows only repo info usage' '\n> +\ttest_must_fail git repo info -h >actual &&\n> +\ttest_grep \"git repo info\" actual &&\n> +\ttest_grep ! \"git repo structure\" actual\n> +'\n>  test_done\n> diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh\n> index 98921ce1cb..0f7ec4da10 100755\n> --- a/t/t1901-repo-structure.sh\n> +++ b/t/t1901-repo-structure.sh\n> @@ -224,4 +224,9 @@ test_expect_success 'progress meter option' '\n>  \t)\n>  '\n>  \n> +test_expect_success 'git repo structure -h shows only repo structure usage' '\n> +\ttest_must_fail git repo structure -h >actual &&\n> +\ttest_grep \"git repo structure\" actual &&\n> +\ttest_grep ! \"git repo info\" actual\n> +'\n>  test_done\n\nWhitespace issues persist in these test files.\n\nThanks,\n-Stolee\n\n"},{"id":"539867","messageId":"20260324184843.299223-1-mahlet.takassa@gmail.com","threadId":"65338","inReplyTo":"20260323152937.257406-1-mahlet.takassa@gmail.com","subject":"[PATCH v3] repo: show subcommand-specific help text","fromName":"Mahi Kassa","fromEmail":"mahlet.takassa@gmail.com","sentAt":"2026-03-24T18:48:43Z","receivedAt":"2026-03-24T18:49:48Z","isPatch":true,"body":"Use subcommand-specific usage arrays for \"git repo info\" and\n\"git repo structure\" so that each command shows only its own\nsynopsis in help output.\n\nFactor the shared usage strings into macros to avoid\nduplicating the same synopsis text in multiple arrays.\n\nAdd tests to cover the subcommand help behavior.\n\nThe previous reroll mistakenly omitted the requested code\nchanges; this version includes them.\n\n---\nv3:\n- include the requested code changes that were missing from v2\n- factor shared usage strings into macros to avoid duplication\n- restore blank lines between tests and before test_done\n\n builtin/repo.c            | 28 ++++++++++++++++++++++------\n t/t1900-repo-info.sh      |  6 ++++++\n t/t1901-repo-structure.sh |  6 ++++++\n 3 files changed, 34 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/repo.c b/builtin/repo.c\nindex 55f9b9095c..71a5c1c29c 100644\n--- a/builtin/repo.c\n+++ b/builtin/repo.c\n@@ -20,11 +20,27 @@\n #include \"tree-walk.h\"\n #include \"utf8.h\"\n \n+#define REPO_INFO_USAGE \\\n+\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\", \\\n+\t\"git repo info --keys [--format=(lines|nul) | -z]\"\n+\n+#define REPO_STRUCTURE_USAGE \\\n+\t\"git repo structure [--format=(table|lines|nul) | -z]\"\n+\n static const char *const repo_usage[] = {\n-\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n-\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n-\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n-\tNULL\n+\tREPO_INFO_USAGE,\n+\tREPO_STRUCTURE_USAGE,\n+\tNULL,\n+};\n+\n+static const char *const repo_info_usage[] = {\n+\tREPO_INFO_USAGE,\n+\tNULL,\n+};\n+\n+static const char *const repo_structure_usage[] = {\n+\tREPO_STRUCTURE_USAGE,\n+\tNULL,\n };\n \n typedef int get_value_fn(struct repository *repo, struct strbuf *buf);\n@@ -214,7 +230,7 @@ static int cmd_repo_info(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n+\targc = parse_options(argc, argv, prefix, options, repo_info_usage, 0);\n \n \tif (show_keys && (all_keys || argc))\n \t\tdie(_(\"--keys cannot be used with a <key> or --all\"));\n@@ -879,7 +895,7 @@ static int cmd_repo_structure(int argc, const char **argv, const char *prefix,\n \t\tOPT_END()\n \t};\n \n-\targc = parse_options(argc, argv, prefix, options, repo_usage, 0);\n+\targc = parse_options(argc, argv, prefix, options, repo_structure_usage, 0);\n \tif (argc)\n \t\tusage(_(\"too many arguments\"));\n \ndiff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh\nindex a9eb07abe8..39bb77dda0 100755\n--- a/t/t1900-repo-info.sh\n+++ b/t/t1900-repo-info.sh\n@@ -149,4 +149,10 @@ test_expect_success 'git repo info --keys uses lines as its default output forma\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'git repo info -h shows only repo info usage' '\n+\ttest_must_fail git repo info -h >actual &&\n+\ttest_grep \"git repo info\" actual &&\n+\ttest_grep ! \"git repo structure\" actual\n+'\n+\n test_done\ndiff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh\nindex 98921ce1cb..10050abd70 100755\n--- a/t/t1901-repo-structure.sh\n+++ b/t/t1901-repo-structure.sh\n@@ -224,4 +224,10 @@ test_expect_success 'progress meter option' '\n \t)\n '\n \n+test_expect_success 'git repo structure -h shows only repo structure usage' '\n+\ttest_must_fail git repo structure -h >actual &&\n+\ttest_grep \"git repo structure\" actual &&\n+\ttest_grep ! \"git repo info\" actual\n+'\n+\n test_done\n-- \n2.34.1\n\n"},{"id":"539872","messageId":"017a4371-3b63-456a-9ca8-e36d6e9dc7d3@gmail.com","threadId":"65338","inReplyTo":"20260324184843.299223-1-mahlet.takassa@gmail.com","subject":"Re: [PATCH v3] repo: show subcommand-specific help text","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2026-03-24T19:15:14Z","receivedAt":"2026-03-24T19:15:17Z","isPatch":true,"body":"On 3/24/2026 2:48 PM, Mahi Kassa wrote:\n> Use subcommand-specific usage arrays for \"git repo info\" and\n> \"git repo structure\" so that each command shows only its own\n> synopsis in help output.\n> \n> Factor the shared usage strings into macros to avoid\n> duplicating the same synopsis text in multiple arrays.\n> \n> Add tests to cover the subcommand help behavior.\n\nYou need a sign-off in your commit message.\n \n> The previous reroll mistakenly omitted the requested code\n> changes; this version includes them.\n\nThis kind of information needs to be below the --- along with\nyour \"V3\" changes:\n \n> ---\n> v3:\n> - include the requested code changes that were missing from v2\n> - factor shared usage strings into macros to avoid duplication\n> - restore blank lines between tests and before test_done\n\n(here)\n\nOutside of these issues with the message, the diff itself\nlooks good.\n\nThanks,\n-Stolee\n\n"},{"id":"539923","messageId":"acOye5MbsFVOa1vJ@pks.im","threadId":"65338","inReplyTo":"20260324184843.299223-1-mahlet.takassa@gmail.com","subject":"Re: [PATCH v3] repo: show subcommand-specific help text","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-25T10:01:31Z","receivedAt":"2026-03-25T10:01:38Z","isPatch":true,"body":"On Tue, Mar 24, 2026 at 07:48:43PM +0100, Mahi Kassa wrote:\n> Use subcommand-specific usage arrays for \"git repo info\" and\n> \"git repo structure\" so that each command shows only its own\n> synopsis in help output.\n> \n> Factor the shared usage strings into macros to avoid\n> duplicating the same synopsis text in multiple arrays.\n> \n> Add tests to cover the subcommand help behavior.\n> \n> The previous reroll mistakenly omitted the requested code\n> changes; this version includes them.\n> \n> ---\n> v3:\n> - include the requested code changes that were missing from v2\n> - factor shared usage strings into macros to avoid duplication\n> - restore blank lines between tests and before test_done\n\nBy the way, it is highly recommended to respond to some of the review\nmails directly, as it helps to create a dialog between submitter and\nreviewer. Otherwise reviewers may feel as if they are talking to a code\nemitting entity :)\n\nIt's not necessary to reply to every single mail, but going like \"Oops,\nyes, I indeed forgot to add the request code changes. Will fix in the\nnext version\" can go a long way to make the interaction more social.\n\n> diff --git a/builtin/repo.c b/builtin/repo.c\n> index 55f9b9095c..71a5c1c29c 100644\n> --- a/builtin/repo.c\n> +++ b/builtin/repo.c\n> @@ -20,11 +20,27 @@\n>  #include \"tree-walk.h\"\n>  #include \"utf8.h\"\n>  \n> +#define REPO_INFO_USAGE \\\n> +\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\", \\\n> +\t\"git repo info --keys [--format=(lines|nul) | -z]\"\n> +\n> +#define REPO_STRUCTURE_USAGE \\\n> +\t\"git repo structure [--format=(table|lines|nul) | -z]\"\n> +\n>  static const char *const repo_usage[] = {\n> -\t\"git repo info [--format=(lines|nul) | -z] [--all | <key>...]\",\n> -\t\"git repo info --keys [--format=(lines|nul) | -z]\",\n> -\t\"git repo structure [--format=(table|lines|nul) | -z]\",\n> -\tNULL\n> +\tREPO_INFO_USAGE,\n> +\tREPO_STRUCTURE_USAGE,\n> +\tNULL,\n> +};\n> +\n> +static const char *const repo_info_usage[] = {\n> +\tREPO_INFO_USAGE,\n> +\tNULL,\n> +};\n> +\n> +static const char *const repo_structure_usage[] = {\n> +\tREPO_STRUCTURE_USAGE,\n> +\tNULL,\n>  };\n>  \n>  typedef int get_value_fn(struct repository *repo, struct strbuf *buf);\n\nI think it would make sense to split this out into two commits: one\nwhere you introduce the macros as a preparatory refactoring, and then\nthe next one where you start to differentiate the different usage\nstrings.\n\nOtherwise this looks good to me now, thanks!\n\nPatrick\n"},{"id":"539964","messageId":"xmqq341nx30z.fsf@gitster.g","threadId":"65338","inReplyTo":"acOye5MbsFVOa1vJ@pks.im","subject":"Re: [PATCH v3] repo: show subcommand-specific help text","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-25T16:55:08Z","receivedAt":"2026-03-25T16:55:11Z","isPatch":true,"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n>> v3:\n>> - include the requested code changes that were missing from v2\n>> - factor shared usage strings into macros to avoid duplication\n>> - restore blank lines between tests and before test_done\n>\n> By the way, it is highly recommended to respond to some of the review\n> mails directly, as it helps to create a dialog between submitter and\n> reviewer. Otherwise reviewers may feel as if they are talking to a code\n> emitting entity :)\n>\n> It's not necessary to reply to every single mail, but going like \"Oops,\n> yes, I indeed forgot to add the request code changes. Will fix in the\n> next version\" can go a long way to make the interaction more social.\n\nHear! hear!  A new iteration without any introduction is harder to\naccept without such a pre-warning to suggest what the author thought\nafter getting suggestions in earlier reviews.  Did they agree and\ntook the suggestion?  Did they disagree but took the suggestion\nanyway, and if so why did they think the suggestion was not such a\ngood change?  Did they disagree and did not take the suggestion and\nif so why?  They changed the code but not in the way suggested in\nthe review, but why the new way was thought to be better than both\nthe original and the reviewer input is unknown?  \n"}]}