{"thread":{"id":"16379","subject":"[PATCH 2/2] git-remote: add verbose mode to git remote update","startedAt":"2008-11-18T11:04:02Z","lastAt":"2008-11-19T01:53:23Z","messageCount":2,"participants":["crquan@gmail.com","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"96081","messageId":"1227006242-21290-1-git-send-email-crquan@gmail.com","threadId":"16379","inReplyTo":null,"subject":"[PATCH 2/2] git-remote: add verbose mode to git remote update","fromName":"","fromEmail":"crquan@gmail.com","sentAt":"2008-11-18T11:04:02Z","receivedAt":"2008-11-18T11:04:02Z","isPatch":true,"sender":{"key":"crquan@gmail.com","avatar":"https://gravatar.com/avatar/8689a8a26f5d1c7515ca8226258710684dac5c5208b84a9e16a086377f2d3ded?d=mp&s=160"},"body":"From: Cheng Renquan <crquan@gmail.com>\n\nPass the verbose mode parameter to the underlying fetch command.\n\n  $ ./git remote -v update\n  Updating origin\n  From git://git.kernel.org/pub/scm/git/git\n   = [up to date]      html       -> origin/html\n   = [up to date]      maint      -> origin/maint\n   = [up to date]      man        -> origin/man\n   = [up to date]      master     -> origin/master\n   = [up to date]      next       -> origin/next\n   = [up to date]      pu         -> origin/pu\n   = [up to date]      todo       -> origin/todo\n\nSigned-off-by: Cheng Renquan <crquan@gmail.com>\n---\n\nTo Junio:\n  I found that fetch's verbose mode will dump the url, that's really\nwhat I need, so with passing verbose mode to fetch, the fetch_remote\nfunction doesn't need a url parameter, and changes to get_one_remote_for_update\nare also not required.\n  So now the patch looks very simple.\n\n builtin-remote.c |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 14774e3..0af742b 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -14,7 +14,7 @@ static const char * const builtin_remote_usage[] = {\n \t\"git remote rm <name>\",\n \t\"git remote show [-n] <name>\",\n \t\"git remote prune [-n | --dry-run] <name>\",\n-\t\"git remote update [group]\",\n+\t\"git remote update [-v | --verbose] [group]\",\n \tNULL\n };\n \n@@ -42,7 +42,11 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not)\n \n static int fetch_remote(const char *name)\n {\n-\tconst char *argv[] = { \"fetch\", name, NULL };\n+\tconst char *argv[] = { \"fetch\", name, NULL, NULL };\n+\tif (verbose) {\n+\t\targv[1] = \"-v\";\n+\t\targv[2] = name;\n+\t}\n \tprintf(\"Updating %s\\n\", name);\n \tif (run_command_v_opt(argv, RUN_GIT_CMD))\n \t\treturn error(\"Could not fetch %s\", name);\n-- \n1.6.0.4.757.g6d002.dirty\n"},{"id":"96117","messageId":"7vod0ctrak.fsf@gitster.siamese.dyndns.org","threadId":"16379","inReplyTo":"1227006242-21290-1-git-send-email-crquan@gmail.com","subject":"Re: [PATCH 2/2] git-remote: add verbose mode to git remote update","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-19T01:53:23Z","receivedAt":"2008-11-19T01:53:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"crquan@gmail.com writes:\n\n> From: Cheng Renquan <crquan@gmail.com>\n>\n> Pass the verbose mode parameter to the underlying fetch command.\n>\n>   $ ./git remote -v update\n>   Updating origin\n>   From git://git.kernel.org/pub/scm/git/git\n>   ...\n> Signed-off-by: Cheng Renquan <crquan@gmail.com>\n> ---\n>   So now the patch looks very simple.\n\nIndeed it does ;-), but there still is a minor nit.\n\n> +\t\"git remote update [-v | --verbose] [group]\",\n\nNotice the difference between the example in your commit log message and\nthe help text?\n\nI think \"git remote [options] [cmd] [more options]\" which is the current\noption parser seems to try doing is very misguided, and a longer term\nfix-up might be to redo the cmd_remote() option parser, but in the short\nterm, let's apply your patch with the following minor fixup:\n\ndiff --git c/builtin-remote.c w/builtin-remote.c\nindex 0af742b..abc8dd8 100644\n--- c/builtin-remote.c\n+++ w/builtin-remote.c\n@@ -14,7 +14,7 @@ static const char * const builtin_remote_usage[] = {\n \t\"git remote rm <name>\",\n \t\"git remote show [-n] <name>\",\n \t\"git remote prune [-n | --dry-run] <name>\",\n-\t\"git remote update [-v | --verbose] [group]\",\n+\t\"git remote [-v | --verbose] update [group]\",\n \tNULL\n };\n \n"}]}