{"thread":{"id":"35265","subject":"Re: [L10N] Kick off for Git 1.8.5 l10n round 1","startedAt":"2013-11-02T02:41:40Z","lastAt":"2013-11-03T08:03:34Z","messageCount":4,"participants":["Trần Ngọc Quân","Thomas Rast","Jiang Xin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"230028","messageId":"52746664.1050806@gmail.com","threadId":"35265","inReplyTo":"CANYiYbGmiBK23=A=MbkfSWwe8X8q3vYSvYPZXhKTLUsbLbMDsw@mail.gmail.com","subject":"Re: [L10N] Kick off for Git 1.8.5 l10n round 1","fromName":"Trần Ngọc Quân","fromEmail":"vnwildman@gmail.com","sentAt":"2013-11-02T02:41:40Z","receivedAt":"2013-11-02T02:41:40Z","isPatch":false,"sender":{"key":"vnwildman@gmail.com","avatar":"https://avatars.githubusercontent.com/u/508758?v=4"},"body":"On 02/11/2013 09:23, Jiang Xin wrote:\n> 2013/11/2 Trần Ngọc Quân <vnwildman@gmail.com>:\n>> Strings in builtin/remote.c line 15 and 42 is similar, please change to\n>> same string in order to reduce gettext database (.mo file)\n>> --\n>>  Trần Ngọc Quân.\n> Confirmed, there is a typo in builtin/remote.c line 15. Have you send\n> patch to this list for this, Trần?\n>\nThis is minor error, so let Junio C Hamano do it!\n\n-- \nTrần Ngọc Quân.\n"},{"id":"230038","messageId":"c2d51c4014545f037bb9399dba7b378d6d79d18b.1383407880.git.tr@thomasrast.ch","threadId":"35265","inReplyTo":"52746664.1050806@gmail.com","subject":"[PATCH] remote: unify main and subcommand usage strings","fromName":"Thomas Rast","fromEmail":"tr@thomasrast.ch","sentAt":"2013-11-02T16:11:31Z","receivedAt":"2013-11-02T16:11:31Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"We had separate usages for each subcommand, and for the main command,\neven though the latter is essentially a concatenation of all of the\nformer.  This leads to a lot of duplication and unnecessary\ndifferences, e.g., in the 'set-head' case the two strings differ only\nin a space.\n\nUnify the strings in the usages by putting each of them in a variable,\nand assembling the usage arrays from them.\n\nNote that this patch changes the usage strings for the following\nsubcommands:\n\n- prune and show: the individual usage only said [<options>].  Kept\n  the snippet from the main usage, which is more specific.\n\n- set-branches: kept the main usage, which is more concise in saying\n  that --add is optional\n\nReported-by: Trần Ngọc Quân <vnwildman@gmail.com>\nSigned-off-by: Thomas Rast <tr@thomasrast.ch>\n---\n\nTrần Ngọc Quân <vnwildman@gmail.com> wrote:\n> On 02/11/2013 09:23, Jiang Xin wrote:\n> > Confirmed, there is a typo in builtin/remote.c line 15. Have you send\n> > patch to this list for this, Trần?\n> >\n> This is minor error, so let Junio C Hamano do it!\n\nDunno, this generally isn't the nicest way to get things done, nor the\nmost productive use of maintainer bandwidth.\n\nHow about patching it like this instead?  That should prevent similar\nissues from cropping up again.\n\n\n builtin/remote.c | 70 +++++++++++++++++++++++++++++++++++++-------------------\n 1 file changed, 47 insertions(+), 23 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 4e14891..2f6366a 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -7,67 +7,91 @@\n #include \"run-command.h\"\n #include \"refs.h\"\n \n+static const char builtin_remote_add_usage_str[] =\n+\tN_(\"git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] \"\n+\t   \"[--mirror=<fetch|push>] <name> <url>\");\n+static const char builtin_remote_rename_usage_str[] =\n+\tN_(\"git remote rename <old> <new>\");\n+static const char builtin_remote_rm_usage_str[] =\n+\tN_(\"git remote remove <name>\");\n+static const char builtin_remote_sethead_usage_str[] =\n+\tN_(\"git remote set-head <name> (-a | --auto | -d | --delete | <branch>)\");\n+static const char builtin_remote_setbranches_usage_str[] =\n+\tN_(\"git remote set-branches [--add] <name> <branch>...\");\n+static const char builtin_remote_show_usage_str[] =\n+\tN_(\"git remote [-v | --verbose] show [-n] <name>\");\n+static const char builtin_remote_prune_usage_str[] =\n+\tN_(\"git remote prune [-n | --dry-run] <name>\");\n+static const char builtin_remote_update_usage_str[] =\n+\tN_(\"git remote [-v | --verbose] update [-p | --prune] \"\n+\t   \"[(<group> | <remote>)...]\");\n+static const char builtin_remote_seturl_usage_str[] =\n+\tN_(\"git remote set-url [--push] <name> <newurl> [<oldurl>]\");\n+static const char builtin_remote_seturl_add_usage_str[] =\n+\tN_(\"git remote set-url --add <name> <newurl>\");\n+static const char builtin_remote_seturl_delete_usage_str[] =\n+\tN_(\"git remote set-url --delete <name> <url>\");\n+\n static const char * const builtin_remote_usage[] = {\n \tN_(\"git remote [-v | --verbose]\"),\n-\tN_(\"git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>\"),\n-\tN_(\"git remote rename <old> <new>\"),\n-\tN_(\"git remote remove <name>\"),\n-\tN_(\"git remote set-head <name> (-a | --auto | -d | --delete |<branch>)\"),\n-\tN_(\"git remote [-v | --verbose] show [-n] <name>\"),\n-\tN_(\"git remote prune [-n | --dry-run] <name>\"),\n-\tN_(\"git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]\"),\n-\tN_(\"git remote set-branches [--add] <name> <branch>...\"),\n-\tN_(\"git remote set-url [--push] <name> <newurl> [<oldurl>]\"),\n-\tN_(\"git remote set-url --add <name> <newurl>\"),\n-\tN_(\"git remote set-url --delete <name> <url>\"),\n+\tbuiltin_remote_add_usage_str,\n+\tbuiltin_remote_rename_usage_str,\n+\tbuiltin_remote_rm_usage_str,\n+\tbuiltin_remote_sethead_usage_str,\n+\tbuiltin_remote_show_usage_str,\n+\tbuiltin_remote_prune_usage_str,\n+\tbuiltin_remote_update_usage_str,\n+\tbuiltin_remote_setbranches_usage_str,\n+\tbuiltin_remote_seturl_usage_str,\n+\tbuiltin_remote_seturl_add_usage_str,\n+\tbuiltin_remote_seturl_delete_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_add_usage[] = {\n-\tN_(\"git remote add [<options>] <name> <url>\"),\n+\tbuiltin_remote_add_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_rename_usage[] = {\n-\tN_(\"git remote rename <old> <new>\"),\n+\tbuiltin_remote_rename_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_rm_usage[] = {\n-\tN_(\"git remote remove <name>\"),\n+\tbuiltin_remote_rm_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_sethead_usage[] = {\n-\tN_(\"git remote set-head <name> (-a | --auto | -d | --delete | <branch>)\"),\n+\tbuiltin_remote_sethead_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_setbranches_usage[] = {\n-\tN_(\"git remote set-branches <name> <branch>...\"),\n-\tN_(\"git remote set-branches --add <name> <branch>...\"),\n+\tbuiltin_remote_setbranches_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_show_usage[] = {\n-\tN_(\"git remote show [<options>] <name>\"),\n+\tbuiltin_remote_show_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_prune_usage[] = {\n-\tN_(\"git remote prune [<options>] <name>\"),\n+\tbuiltin_remote_prune_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_update_usage[] = {\n-\tN_(\"git remote update [<options>] [<group> | <remote>]...\"),\n+\tbuiltin_remote_update_usage_str,\n \tNULL\n };\n \n static const char * const builtin_remote_seturl_usage[] = {\n-\tN_(\"git remote set-url [--push] <name> <newurl> [<oldurl>]\"),\n-\tN_(\"git remote set-url --add <name> <newurl>\"),\n-\tN_(\"git remote set-url --delete <name> <url>\"),\n+\tbuiltin_remote_seturl_usage_str,\n+\tbuiltin_remote_seturl_add_usage_str,\n+\tbuiltin_remote_seturl_delete_usage_str,\n \tNULL\n };\n \n-- \n1.8.4.2.838.g4c8c068\n"},{"id":"230046","messageId":"CANYiYbGD=VJ64pESwxkMYy8HxESyW_2N0Q5M92rCJF2E1FD-bw@mail.gmail.com","threadId":"35265","inReplyTo":"c2d51c4014545f037bb9399dba7b378d6d79d18b.1383407880.git.tr@thomasrast.ch","subject":"Re: [PATCH] remote: unify main and subcommand usage strings","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-11-03T07:17:10Z","receivedAt":"2013-11-03T07:17:10Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2013/11/3 Thomas Rast <tr@thomasrast.ch>:\n> We had separate usages for each subcommand, and for the main command,\n> even though the latter is essentially a concatenation of all of the\n> former.  This leads to a lot of duplication and unnecessary\n> differences, e.g., in the 'set-head' case the two strings differ only\n> in a space.\n>\n> Unify the strings in the usages by putting each of them in a variable,\n> and assembling the usage arrays from them.\n>\n> Note that this patch changes the usage strings for the following\n> subcommands:\n>\n> - prune and show: the individual usage only said [<options>].  Kept\n>   the snippet from the main usage, which is more specific.\n>\n> - set-branches: kept the main usage, which is more concise in saying\n>   that --add is optional\n>\n\nDifferences of git-remote usages after applied your patch.\n\ndiff -u before/git-remote-add-usage after/git-remote-add-usage\n--- before/git-remote-add-usage 2013-11-03 15:10:06.000000000 +0800\n+++ after/git-remote-add-usage 2013-11-03 15:11:32.000000000 +0800\n@@ -1,4 +1,4 @@\n-usage: git remote add [<options>] <name> <url>\n+usage: git remote add [-t <branch>] [-m <master>] [-f]\n[--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>\n\n     -f, --fetch           fetch the remote branches\n     --tags                import all tags and associated objects when fetching\n\ndiff -u before/git-remote-prune-usage after/git-remote-prune-usage\n--- before/git-remote-prune-usage 2013-11-03 15:10:06.000000000 +0800\n+++ after/git-remote-prune-usage 2013-11-03 15:11:32.000000000 +0800\n@@ -1,4 +1,4 @@\n-usage: git remote prune [<options>] <name>\n+usage: git remote prune [-n | --dry-run] <name>\n\n     -n, --dry-run         dry run\n\ndiff -u before/git-remote-set-branches-usage after/git-remote-set-branches-usage\n--- before/git-remote-set-branches-usage 2013-11-03 15:10:06.000000000 +0800\n+++ after/git-remote-set-branches-usage 2013-11-03 15:11:32.000000000 +0800\n@@ -1,5 +1,4 @@\n-usage: git remote set-branches <name> <branch>...\n-   or: git remote set-branches --add <name> <branch>...\n+usage: git remote set-branches [--add] <name> <branch>...\n\n     --add                 add branch\n\ndiff -u before/git-remote-show-usage after/git-remote-show-usage\n--- before/git-remote-show-usage 2013-11-03 15:10:06.000000000 +0800\n+++ after/git-remote-show-usage 2013-11-03 15:11:32.000000000 +0800\n@@ -1,4 +1,4 @@\n-usage: git remote show [<options>] <name>\n+usage: git remote [-v | --verbose] show [-n] <name>\n\n     -n                    do not query remotes\n\ndiff -u before/git-remote-update-usage after/git-remote-update-usage\n--- before/git-remote-update-usage 2013-11-03 15:10:06.000000000 +0800\n+++ after/git-remote-update-usage 2013-11-03 15:11:32.000000000 +0800\n@@ -1,4 +1,4 @@\n-usage: git remote update [<options>] [<group> | <remote>]...\n+usage: git remote [-v | --verbose] update [-p | --prune] [(<group> |\n<remote>)...]\n\n     -p, --prune           prune remotes after fetching\n\n\n\n\n-- \nJiang Xin\n"},{"id":"230048","messageId":"CANYiYbGh-HR+hJcLg9AGbdXU=ypW8YwFqVcyVactJMYg4OOF7w@mail.gmail.com","threadId":"35265","inReplyTo":"CANYiYbGD=VJ64pESwxkMYy8HxESyW_2N0Q5M92rCJF2E1FD-bw@mail.gmail.com","subject":"Re: [PATCH] remote: unify main and subcommand usage strings","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-11-03T08:03:34Z","receivedAt":"2013-11-03T08:03:34Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2013/11/3 Jiang Xin <worldhello.net@gmail.com>:\n> 2013/11/3 Thomas Rast <tr@thomasrast.ch>:\n>> Note that this patch changes the usage strings for the following\n>> subcommands:\n>\n> Differences of git-remote usages after applied your patch.\n>\n> diff -u before/git-remote-add-usage after/git-remote-add-usage\n> --- before/git-remote-add-usage 2013-11-03 15:10:06.000000000 +0800\n> +++ after/git-remote-add-usage 2013-11-03 15:11:32.000000000 +0800\n> @@ -1,4 +1,4 @@\n> -usage: git remote add [<options>] <name> <url>\n> +usage: git remote add [-t <branch>] [-m <master>] [-f]\n> [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>\n>\n>      -f, --fetch           fetch the remote branches\n>      --tags                import all tags and associated objects when fetching\n>\n> diff -u before/git-remote-prune-usage after/git-remote-prune-usage\n> --- before/git-remote-prune-usage 2013-11-03 15:10:06.000000000 +0800\n> +++ after/git-remote-prune-usage 2013-11-03 15:11:32.000000000 +0800\n> @@ -1,4 +1,4 @@\n> -usage: git remote prune [<options>] <name>\n> +usage: git remote prune [-n | --dry-run] <name>\n>\n>      -n, --dry-run         dry run\n>\n> diff -u before/git-remote-set-branches-usage after/git-remote-set-branches-usage\n> --- before/git-remote-set-branches-usage 2013-11-03 15:10:06.000000000 +0800\n> +++ after/git-remote-set-branches-usage 2013-11-03 15:11:32.000000000 +0800\n> @@ -1,5 +1,4 @@\n> -usage: git remote set-branches <name> <branch>...\n> -   or: git remote set-branches --add <name> <branch>...\n> +usage: git remote set-branches [--add] <name> <branch>...\n>\n>      --add                 add branch\n>\n> diff -u before/git-remote-show-usage after/git-remote-show-usage\n> --- before/git-remote-show-usage 2013-11-03 15:10:06.000000000 +0800\n> +++ after/git-remote-show-usage 2013-11-03 15:11:32.000000000 +0800\n> @@ -1,4 +1,4 @@\n> -usage: git remote show [<options>] <name>\n> +usage: git remote [-v | --verbose] show [-n] <name>\n>\n>      -n                    do not query remotes\n>\n> diff -u before/git-remote-update-usage after/git-remote-update-usage\n> --- before/git-remote-update-usage 2013-11-03 15:10:06.000000000 +0800\n> +++ after/git-remote-update-usage 2013-11-03 15:11:32.000000000 +0800\n> @@ -1,4 +1,4 @@\n> -usage: git remote update [<options>] [<group> | <remote>]...\n> +usage: git remote [-v | --verbose] update [-p | --prune] [(<group> |\n> <remote>)...]\n>\n>      -p, --prune           prune remotes after fetching\n>\n\nIn order to get the differences of git-remote usages, I write a script.\n\n    # SCRIPT to save git remote usage in files.\n    for cmd in add set-head show prune update set-branches set-url; do\n            git remote $cmd -h > $DIR/git-remote-$cmd-usage\n    done\n    git remote -h > $DIR/git-remote-usage\n    git remote remove  > $DIR/git-remote-remove-usage 2>&1\n    git remote rename  > $DIR/git-remote-rename-usage  2>&1\n\nThen I find two subcommands (remove and rename) are strange.\n\n * All other subcommands output usages to STDIN, but subcommands\n    \"remove\" and \"rename\" send their usages to STDERR.\n\n * I can get the help message of all other subcommands using:\n   \"git remote <subcmd> -h\", but not \"git remote rm -h\"\n\n        $ git remote rm -h\n        error: Could not remove config section 'remote.-h'\n\nLater I know it's a side-effect that all other subcommands could\nprint usages if provide a unkown \"-h/--help\" option.\n\nWhat if add a parse_options call for both \"rm\" and \"mv\" functions\nin builtin/remote.c?\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 2f6366a..171d1a8 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -651,6 +651,8 @@ static int mv(int argc, const char **argv)\n        struct rename_info rename;\n        int i, refspec_updated = 0;\n\n+       argc = parse_options(argc, argv, NULL, options,\n+                            builtin_remote_rename_usage, 0);\n        if (argc != 3)\n                usage_with_options(builtin_remote_rename_usage, options);\n\n@@ -808,6 +810,8 @@ static int rm(int argc, const char **argv)\n        cb_data.skipped = &skipped;\n        cb_data.keep = &known_remotes;\n\n+       argc = parse_options(argc, argv, NULL, options,\n+                            builtin_remote_rm_usage,0);\n        if (argc != 2)\n                usage_with_options(builtin_remote_rm_usage, options);\n\n\n-- \nJiang Xin\n"}]}