{"thread":{"id":"21611","subject":"[PATCH 0/2] Migrate ls-tree to parse-opts","startedAt":"2009-11-14T04:34:06Z","lastAt":"2009-11-18T23:10:02Z","messageCount":10,"participants":["Stephen Boyd","Junio C Hamano","Thiago Farina"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"127531","messageId":"1258173248-31059-1-git-send-email-bebarino@gmail.com","threadId":"21611","inReplyTo":null,"subject":"[PATCH 0/2] Migrate ls-tree to parse-opts","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-11-14T04:34:06Z","receivedAt":"2009-11-14T04:34:06Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"This looked pretty straightforward. I guess --name-status is there\nfor backward compatibility. Should it be there anymore?\n\nStephen Boyd (2):\n  t3101: test more ls-tree options\n  ls-tree: migrate to parse-options\n\n builtin-ls-tree.c          |  100 +++++++++++++++++--------------------------\n t/t3101-ls-tree-dirname.sh |   89 ++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 127 insertions(+), 62 deletions(-)\n"},{"id":"127533","messageId":"1258173248-31059-2-git-send-email-bebarino@gmail.com","threadId":"21611","inReplyTo":"1258173248-31059-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 1/2] t3101: test more ls-tree options","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-11-14T04:34:07Z","receivedAt":"2009-11-14T04:34:07Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Add tests for --full-name, --full-tree, --abbrev, and --name-only.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n t/t3101-ls-tree-dirname.sh |   89 +++++++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 87 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh\nindex 51cb4a3..99458e4 100755\n--- a/t/t3101-ls-tree-dirname.sh\n+++ b/t/t3101-ls-tree-dirname.sh\n@@ -39,8 +39,8 @@ test_expect_success \\\n      tree=`git write-tree` &&\n      echo $tree'\n \n-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n+_x5='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n+_x40=\"$_x5$_x5$_x5$_x5$_x5$_x5$_x5$_x5\"\n test_output () {\n     sed -e \"s/ $_x40\t/ X\t/\" <current >check\n     test_cmp expected check\n@@ -141,4 +141,89 @@ test_expect_success 'ls-tree filter is leading path match' '\n \ttest_output\n '\n \n+test_expect_success 'ls-tree --full-name' '\n+\t(\n+\t\tcd path0 &&\n+\t\tgit ls-tree --full-name $tree a\n+\t) > current &&\n+\tcat >expected <<\\EOF &&\n+040000 tree X\tpath0/a\n+EOF\n+\ttest_output\n+'\n+\n+test_expect_success 'ls-tree --full-tree' '\n+\t(\n+\t\tcd path1/b/c &&\n+\t\tgit ls-tree --full-tree $tree\n+\t) > current &&\n+\tcat >expected <<\\EOF &&\n+100644 blob X\t1.txt\n+100644 blob X\t2.txt\n+040000 tree X\tpath0\n+040000 tree X\tpath1\n+040000 tree X\tpath2\n+040000 tree X\tpath3\n+EOF\n+\ttest_output\n+'\n+\n+test_expect_success 'ls-tree --full-tree -r' '\n+\t(\n+\t\tcd path3/ &&\n+\t\tgit ls-tree --full-tree -r $tree\n+\t) > current &&\n+\tcat >expected <<\\EOF &&\n+100644 blob X\t1.txt\n+100644 blob X\t2.txt\n+100644 blob X\tpath0/a/b/c/1.txt\n+100644 blob X\tpath1/b/c/1.txt\n+100644 blob X\tpath2/1.txt\n+100644 blob X\tpath3/1.txt\n+100644 blob X\tpath3/2.txt\n+EOF\n+\ttest_output\n+'\n+\n+test_expect_success 'ls-tree --abbrev=5' '\n+\tgit ls-tree --abbrev=5 $tree > current.abbrev &&\n+\tsed -e \"s/ $_x5\t/ X\t/\"  < current.abbrev > current &&\n+\tcat >expected <<\\EOF &&\n+100644 blob X\t1.txt\n+100644 blob X\t2.txt\n+040000 tree X\tpath0\n+040000 tree X\tpath1\n+040000 tree X\tpath2\n+040000 tree X\tpath3\n+EOF\n+\ttest_output\n+'\n+\n+test_expect_success 'ls-tree --name-only' '\n+\tgit ls-tree --name-only $tree > current\n+\tcat >expected <<\\EOF &&\n+1.txt\n+2.txt\n+path0\n+path1\n+path2\n+path3\n+EOF\n+\ttest_output\n+'\n+\n+test_expect_success 'ls-tree --name-only -r' '\n+\tgit ls-tree --name-only -r $tree > current\n+\tcat >expected <<\\EOF &&\n+1.txt\n+2.txt\n+path0/a/b/c/1.txt\n+path1/b/c/1.txt\n+path2/1.txt\n+path3/1.txt\n+path3/2.txt\n+EOF\n+\ttest_output\n+'\n+\n test_done\n-- \n1.6.5.2.155.gbb47\n"},{"id":"127532","messageId":"1258173248-31059-3-git-send-email-bebarino@gmail.com","threadId":"21611","inReplyTo":"1258173248-31059-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 2/2] ls-tree: migrate to parse-options","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-11-14T04:34:08Z","receivedAt":"2009-11-14T04:34:08Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n builtin-ls-tree.c |  100 +++++++++++++++++++++-------------------------------\n 1 files changed, 40 insertions(+), 60 deletions(-)\n\ndiff --git a/builtin-ls-tree.c b/builtin-ls-tree.c\nindex 22008df..04408df 100644\n--- a/builtin-ls-tree.c\n+++ b/builtin-ls-tree.c\n@@ -9,6 +9,7 @@\n #include \"commit.h\"\n #include \"quote.h\"\n #include \"builtin.h\"\n+#include \"parse-options.h\"\n \n static int line_termination = '\\n';\n #define LS_RECURSIVE 1\n@@ -22,8 +23,10 @@ static const char **pathspec;\n static int chomp_prefix;\n static const char *ls_tree_prefix;\n \n-static const char ls_tree_usage[] =\n-\t\"git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]\";\n+static const  char * const ls_tree_usage[] = {\n+\t\"git ls-tree [-d] [-r] [-t] [-l | --long] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]\",\n+\tNULL\n+};\n \n static int show_recursive(const char *base, int baselen, const char *pathname)\n {\n@@ -117,76 +120,53 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)\n {\n \tunsigned char sha1[20];\n \tstruct tree *tree;\n+\tint full_tree = 0;\n+\tconst struct option ls_tree_options[] = {\n+\t\tOPT_BIT('d', NULL, &ls_options, \"only show trees\",\n+\t\t\tLS_TREE_ONLY),\n+\t\tOPT_BIT('r', NULL, &ls_options, \"recurse into subtrees\",\n+\t\t\tLS_RECURSIVE),\n+\t\tOPT_BIT('t', NULL, &ls_options, \"show trees when recursing\",\n+\t\t\tLS_SHOW_TREES),\n+\t\tOPT_SET_INT('z', NULL, &line_termination,\n+\t\t\t    \"terminate entries with NUL byte\", 0),\n+\t\tOPT_BIT('l', \"long\", &ls_options, \"include object size\",\n+\t\t\tLS_SHOW_SIZE),\n+\t\tOPT_BIT(0, \"name-only\", &ls_options, \"list only filenames\",\n+\t\t\tLS_NAME_ONLY),\n+\t\tOPT_BIT(0, \"name-status\", &ls_options, \"list only filenames\",\n+\t\t\tLS_NAME_ONLY),\n+\t\tOPT_SET_INT(0, \"full-name\", &chomp_prefix,\n+\t\t\t    \"use full path names\", 0),\n+\t\tOPT_BOOLEAN(0, \"full-tree\", &full_tree,\n+\t\t\t    \"list entire tree; not just current directory \"\n+\t\t\t    \"(implies --full-name)\"),\n+\t\tOPT__ABBREV(&abbrev),\n+\t\tOPT_END()\n+\t};\n \n \tgit_config(git_default_config, NULL);\n \tls_tree_prefix = prefix;\n \tif (prefix && *prefix)\n \t\tchomp_prefix = strlen(prefix);\n-\twhile (1 < argc && argv[1][0] == '-') {\n-\t\tswitch (argv[1][1]) {\n-\t\tcase 'z':\n-\t\t\tline_termination = 0;\n-\t\t\tbreak;\n-\t\tcase 'r':\n-\t\t\tls_options |= LS_RECURSIVE;\n-\t\t\tbreak;\n-\t\tcase 'd':\n-\t\t\tls_options |= LS_TREE_ONLY;\n-\t\t\tbreak;\n-\t\tcase 't':\n-\t\t\tls_options |= LS_SHOW_TREES;\n-\t\t\tbreak;\n-\t\tcase 'l':\n-\t\t\tls_options |= LS_SHOW_SIZE;\n-\t\t\tbreak;\n-\t\tcase '-':\n-\t\t\tif (!strcmp(argv[1]+2, \"name-only\") ||\n-\t\t\t    !strcmp(argv[1]+2, \"name-status\")) {\n-\t\t\t\tls_options |= LS_NAME_ONLY;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tif (!strcmp(argv[1]+2, \"long\")) {\n-\t\t\t\tls_options |= LS_SHOW_SIZE;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tif (!strcmp(argv[1]+2, \"full-name\")) {\n-\t\t\t\tchomp_prefix = 0;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tif (!strcmp(argv[1]+2, \"full-tree\")) {\n-\t\t\t\tls_tree_prefix = prefix = NULL;\n-\t\t\t\tchomp_prefix = 0;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tif (!prefixcmp(argv[1]+2, \"abbrev=\")) {\n-\t\t\t\tabbrev = strtoul(argv[1]+9, NULL, 10);\n-\t\t\t\tif (abbrev && abbrev < MINIMUM_ABBREV)\n-\t\t\t\t\tabbrev = MINIMUM_ABBREV;\n-\t\t\t\telse if (abbrev > 40)\n-\t\t\t\t\tabbrev = 40;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tif (!strcmp(argv[1]+2, \"abbrev\")) {\n-\t\t\t\tabbrev = DEFAULT_ABBREV;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\t/* otherwise fallthru */\n-\t\tdefault:\n-\t\t\tusage(ls_tree_usage);\n-\t\t}\n-\t\targc--; argv++;\n+\n+\targc = parse_options(argc, argv, prefix, ls_tree_options,\n+\t\t\t     ls_tree_usage, 0);\n+\tif (full_tree) {\n+\t\tls_tree_prefix = prefix = NULL;\n+\t\tchomp_prefix = 0;\n \t}\n \t/* -d -r should imply -t, but -d by itself should not have to. */\n \tif ( (LS_TREE_ONLY|LS_RECURSIVE) ==\n \t    ((LS_TREE_ONLY|LS_RECURSIVE) & ls_options))\n \t\tls_options |= LS_SHOW_TREES;\n \n-\tif (argc < 2)\n-\t\tusage(ls_tree_usage);\n-\tif (get_sha1(argv[1], sha1))\n-\t\tdie(\"Not a valid object name %s\", argv[1]);\n+\tif (argc < 1)\n+\t\tusage_with_options(ls_tree_usage, ls_tree_options);\n+\tif (get_sha1(argv[0], sha1))\n+\t\tdie(\"Not a valid object name %s\", argv[0]);\n \n-\tpathspec = get_pathspec(prefix, argv + 2);\n+\tpathspec = get_pathspec(prefix, argv + 1);\n \ttree = parse_tree_indirect(sha1);\n \tif (!tree)\n \t\tdie(\"not a tree object\");\n-- \n1.6.5.2.155.gbb47\n"},{"id":"127733","messageId":"7vws1piscw.fsf@alter.siamese.dyndns.org","threadId":"21611","inReplyTo":"1258173248-31059-2-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 1/2] t3101: test more ls-tree options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-17T06:21:35Z","receivedAt":"2009-11-17T06:21:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.  I'd squash this patch in for the following reasons; Ok?\n\n - The --abbrev=n option only guarantees that at least n hexdigits are\n   used but the implementation is allowed to use more to avoid\n   ambiguities.\n\n - The point of test_output function is that it does its own filtering\n   before comparison; it is misleading to feed it if the caller munges the\n   input.\n\n - Redirection should be immediately followed by filename; this is just a\n   matter of personal taste, but being consistent in the new code is\n   better than resulting in blocks of lines with mixed styles (no, I won't\n   welcome a patch to fix the existing \"cmd > file\", unless it is done as\n   part of a patch aka \"while at it\" that fixes something of substance\n   nearby at the same time).\n\n t/t3101-ls-tree-dirname.sh |   20 ++++++++++----------\n 1 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh\nindex 99458e4..6ef371a 100755\n--- a/t/t3101-ls-tree-dirname.sh\n+++ b/t/t3101-ls-tree-dirname.sh\n@@ -39,8 +39,8 @@ test_expect_success \\\n      tree=`git write-tree` &&\n      echo $tree'\n \n-_x5='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x40=\"$_x5$_x5$_x5$_x5$_x5$_x5$_x5$_x5\"\n+_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n+_x40=\"$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05\"\n test_output () {\n     sed -e \"s/ $_x40\t/ X\t/\" <current >check\n     test_cmp expected check\n@@ -145,7 +145,7 @@ test_expect_success 'ls-tree --full-name' '\n \t(\n \t\tcd path0 &&\n \t\tgit ls-tree --full-name $tree a\n-\t) > current &&\n+\t) >current &&\n \tcat >expected <<\\EOF &&\n 040000 tree X\tpath0/a\n EOF\n@@ -156,7 +156,7 @@ test_expect_success 'ls-tree --full-tree' '\n \t(\n \t\tcd path1/b/c &&\n \t\tgit ls-tree --full-tree $tree\n-\t) > current &&\n+\t) >current &&\n \tcat >expected <<\\EOF &&\n 100644 blob X\t1.txt\n 100644 blob X\t2.txt\n@@ -172,7 +172,7 @@ test_expect_success 'ls-tree --full-tree -r' '\n \t(\n \t\tcd path3/ &&\n \t\tgit ls-tree --full-tree -r $tree\n-\t) > current &&\n+\t) >current &&\n \tcat >expected <<\\EOF &&\n 100644 blob X\t1.txt\n 100644 blob X\t2.txt\n@@ -186,8 +186,8 @@ EOF\n '\n \n test_expect_success 'ls-tree --abbrev=5' '\n-\tgit ls-tree --abbrev=5 $tree > current.abbrev &&\n-\tsed -e \"s/ $_x5\t/ X\t/\"  < current.abbrev > current &&\n+\tgit ls-tree --abbrev=5 $tree >current &&\n+\tsed -e \"s/ $_x05[0-9a-f]*\t/ X\t/\" <current >check &&\n \tcat >expected <<\\EOF &&\n 100644 blob X\t1.txt\n 100644 blob X\t2.txt\n@@ -196,11 +196,11 @@ test_expect_success 'ls-tree --abbrev=5' '\n 040000 tree X\tpath2\n 040000 tree X\tpath3\n EOF\n-\ttest_output\n+\ttest_cmp expected check\n '\n \n test_expect_success 'ls-tree --name-only' '\n-\tgit ls-tree --name-only $tree > current\n+\tgit ls-tree --name-only $tree >current\n \tcat >expected <<\\EOF &&\n 1.txt\n 2.txt\n@@ -213,7 +213,7 @@ EOF\n '\n \n test_expect_success 'ls-tree --name-only -r' '\n-\tgit ls-tree --name-only -r $tree > current\n+\tgit ls-tree --name-only -r $tree >current\n \tcat >expected <<\\EOF &&\n 1.txt\n 2.txt\n-- \n1.6.5.3.283.g4b054\n"},{"id":"127734","messageId":"7vpr7hisc7.fsf@alter.siamese.dyndns.org","threadId":"21611","inReplyTo":"1258173248-31059-3-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 2/2] ls-tree: migrate to parse-options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-17T06:22:00Z","receivedAt":"2009-11-17T06:22:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n\nAs parse-options infrastructure gives much better per-option help text,\nthere is not much point to keep the list of options that can go stale\nin the usage text.\n\nI'd squash this to yours.  Ok?\n\n---\n builtin-ls-tree.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-ls-tree.c b/builtin-ls-tree.c\nindex 04408df..14a913a 100644\n--- a/builtin-ls-tree.c\n+++ b/builtin-ls-tree.c\n@@ -24,7 +24,7 @@ static int chomp_prefix;\n static const char *ls_tree_prefix;\n \n static const  char * const ls_tree_usage[] = {\n-\t\"git ls-tree [-d] [-r] [-t] [-l | --long] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]\",\n+\t\"git ls-tree <options> <tree-ish> [path...]\",\n \tNULL\n };\n \n-- \n1.6.5.3.283.g4b054\n"},{"id":"127737","messageId":"4B024201.2010400@gmail.com","threadId":"21611","inReplyTo":"7vws1piscw.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] t3101: test more ls-tree options","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-11-17T06:26:09Z","receivedAt":"2009-11-17T06:26:09Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Junio C Hamano wrote:\n> Thanks.  I'd squash this patch in for the following reasons; Ok?\n\nLooks good. Thanks.\n\nI figured reusing the test_output function would be a bad idea.\n"},{"id":"127738","messageId":"4B024293.5090000@gmail.com","threadId":"21611","inReplyTo":"7vpr7hisc7.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] ls-tree: migrate to parse-options","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-11-17T06:28:35Z","receivedAt":"2009-11-17T06:28:35Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Junio C Hamano wrote:\n> Thanks.\n>\n> As parse-options infrastructure gives much better per-option help text,\n> there is not much point to keep the list of options that can go stale\n> in the usage text.\n>\n> I'd squash this to yours.  Ok?\n>\n\nI like this style too. Less usage update patches are better. Thanks.\n"},{"id":"127742","messageId":"4B024A89.2010108@gmail.com","threadId":"21611","inReplyTo":"7vpr7hisc7.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] ls-tree: migrate to parse-options","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-11-17T07:02:33Z","receivedAt":"2009-11-17T07:02:33Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Junio C Hamano wrote:\n>\n> @@ -24,7 +24,7 @@ static int chomp_prefix;\n>  static const char *ls_tree_prefix;\n>  \n>  static const  char * const ls_tree_usage[] = {\n> -\t\"git ls-tree [-d] [-r] [-t] [-l | --long] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]\",\n> +\t\"git ls-tree <options> <tree-ish> [path...]\",\n>  \tNULL\n>  };\n>  \n\nIs it [<options>] or [<options>...] or <options> or even <options>... \nthough?\n"},{"id":"127876","messageId":"7veinvcw7w.fsf@alter.siamese.dyndns.org","threadId":"21611","inReplyTo":"4B024A89.2010108@gmail.com","subject":"Re: [PATCH 2/2] ls-tree: migrate to parse-options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-18T22:19:15Z","receivedAt":"2009-11-18T22:19:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>>\n>> @@ -24,7 +24,7 @@ static int chomp_prefix;\n>>  static const char *ls_tree_prefix;\n>>   static const  char * const ls_tree_usage[] = {\n>> -\t\"git ls-tree [-d] [-r] [-t] [-l | --long] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]\",\n>> +\t\"git ls-tree <options> <tree-ish> [path...]\",\n>>  \tNULL\n>>  };\n>>  \n>\n> Is it [<options>] or [<options>...] or <options> or even\n> <options>... though?\n\nOutput from \"git grep -e '<option' -- '*.c'\" indicates that it\nshould be \"[<options>]\"; thanks for spotting.\n"},{"id":"127879","messageId":"a4c8a6d00911181510y66338536wb4b51b0df4788e76@mail.gmail.com","threadId":"21611","inReplyTo":"7veinvcw7w.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] ls-tree: migrate to parse-options","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2009-11-18T23:10:02Z","receivedAt":"2009-11-18T23:10:02Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"On Wed, Nov 18, 2009 at 8:19 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stephen Boyd <bebarino@gmail.com> writes:\n>\n>> Junio C Hamano wrote:\n>>>\n>>> @@ -24,7 +24,7 @@ static int chomp_prefix;\n>>>  static const char *ls_tree_prefix;\n>>>   static const  char * const ls_tree_usage[] = {\n>>> -    \"git ls-tree [-d] [-r] [-t] [-l | --long] [-z] [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]] <tree-ish> [path...]\",\n>>> +    \"git ls-tree <options> <tree-ish> [path...]\",\n>>>      NULL\n>>>  };\n>>>\n>>\n>> Is it [<options>] or [<options>...] or <options> or even\n>> <options>... though?\n>\n> Output from \"git grep -e '<option' -- '*.c'\" indicates that it\n> should be \"[<options>]\"; thanks for spotting.\n\n$ git grep -e '<option' -- '*.c' | wc -l\n4\n\n$ git grep -e '\\[options' -- '*.c' | wc -l\n42\n\n$ git grep -e '\\[<options' -- '*.c' | wc -l\n2\n\nShouldn't be just \"[options]\"?\n"}]}