{"thread":{"id":"21872","subject":"[PATCH] Allow --quiet option to git remote, particularly for `git remote update`","startedAt":"2009-12-06T00:00:23Z","lastAt":"2009-12-07T07:23:13Z","messageCount":6,"participants":["Alex Vandiver","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"129304","messageId":"1260057623-28960-1-git-send-email-alex@chmrr.net","threadId":"21872","inReplyTo":null,"subject":"[PATCH] Allow --quiet option to git remote, particularly for `git remote update`","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-12-06T00:00:23Z","receivedAt":"2009-12-06T00:00:23Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"\nSigned-off-by: Alex Vandiver <alex@chmrr.net>\n---\n builtin-remote.c |   19 ++++++++++++-------\n 1 files changed, 12 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex a501939..a34006f 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -8,14 +8,14 @@\n #include \"refs.h\"\n \n static const char * const builtin_remote_usage[] = {\n-\t\"git remote [-v | --verbose]\",\n+\t\"git remote [-v | --verbose] [-q | --quiet]\",\n \t\"git remote add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>\",\n \t\"git remote rename <old> <new>\",\n \t\"git remote rm <name>\",\n \t\"git remote set-head <name> (-a | -d | <branch>)\",\n \t\"git remote [-v | --verbose] show [-n] <name>\",\n \t\"git remote prune [-n | --dry-run] <name>\",\n-\t\"git remote [-v | --verbose] update [-p | --prune] [group | remote]\",\n+\t\"git remote [-v | --verbose] [-q | --quiet] update [-p | --prune] [group]\",\n \tNULL\n };\n \n@@ -58,7 +58,7 @@ static const char * const builtin_remote_update_usage[] = {\n #define GET_HEAD_NAMES (1<<1)\n #define GET_PUSH_REF_STATES (1<<2)\n \n-static int verbose;\n+static int verbosity;\n \n static int show_all(void);\n static int prune_remote(const char *remote, int dry_run);\n@@ -84,9 +84,12 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not)\n static int fetch_remote(const char *name)\n {\n \tconst char *argv[] = { \"fetch\", name, NULL, NULL };\n-\tif (verbose) {\n+\tif (verbosity > 0) {\n \t\targv[1] = \"-v\";\n \t\targv[2] = name;\n+\t} else if (verbosity < 0) {\n+\t\targv[1] = \"-q\";\n+\t\targv[2] = name;\n \t}\n \tprintf(\"Updating %s\\n\", name);\n \tif (run_command_v_opt(argv, RUN_GIT_CMD))\n@@ -1236,8 +1239,10 @@ static int update(int argc, const char **argv)\n \n \tif (prune)\n \t\tfetch_argv[fetch_argc++] = \"--prune\";\n-\tif (verbose)\n+\tif (verbosity > 0)\n \t\tfetch_argv[fetch_argc++] = \"-v\";\n+\tif (verbosity < 0)\n+\t\tfetch_argv[fetch_argc++] = \"-q\";\n \tif (argc < 2) {\n \t\tfetch_argv[fetch_argc++] = \"default\";\n \t} else {\n@@ -1301,7 +1306,7 @@ static int show_all(void)\n \t\tsort_string_list(&list);\n \t\tfor (i = 0; i < list.nr; i++) {\n \t\t\tstruct string_list_item *item = list.items + i;\n-\t\t\tif (verbose)\n+\t\t\tif (verbosity > 0)\n \t\t\t\tprintf(\"%s\\t%s\\n\", item->string,\n \t\t\t\t\titem->util ? (const char *)item->util : \"\");\n \t\t\telse {\n@@ -1318,7 +1323,7 @@ static int show_all(void)\n int cmd_remote(int argc, const char **argv, const char *prefix)\n {\n \tstruct option options[] = {\n-\t\tOPT_BOOLEAN('v', \"verbose\", &verbose, \"be verbose; must be placed before a subcommand\"),\n+\t\tOPT__VERBOSITY(&verbosity),\n \t\tOPT_END()\n \t};\n \tint result;\n-- \n1.6.6.rc0.360.gc408\n"},{"id":"129308","messageId":"7vd42soo2p.fsf@alter.siamese.dyndns.org","threadId":"21872","inReplyTo":"1260057623-28960-1-git-send-email-alex@chmrr.net","subject":"Re: [PATCH] Allow --quiet option to git remote, particularly for `git remote update`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-06T02:04:14Z","receivedAt":"2009-12-06T02:04:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Vandiver <alex@chmrr.net> writes:\n\n> Signed-off-by: Alex Vandiver <alex@chmrr.net>\n\nSounds good as it makes the behaviour consistent with the underlying \"git\nfetch\".\n\n> ...\n>  \t\"git remote prune [-n | --dry-run] <name>\",\n> -\t\"git remote [-v | --verbose] update [-p | --prune] [group | remote]\",\n> +\t\"git remote [-v | --verbose] [-q | --quiet] update [-p | --prune] [group]\",\n\nWe say \"<name>\" everywhere else except for \"update\" we call the parameter\n\"group\" or \"remote\" using different typography.  It is not the fault of\nyour patch, but has been this way since 1918278 (Allow git-remote to\nupdate named groups of remotes, 2007-02-20).\n\nThree issues to consider:\n\n - shouldn't we use the same typography, i.e. <group>?\n\n - should we say <name> _if_ we are not going to say <group>|<remote>?\n\n - should we keep it as <group>|<remote> to make it clear that only this\n   subcommand allows the group nickname?\n\nThe first two are easy and I expect the answers to be both yes.  The third\none needs some studying and further thought.\n\n - is \"remote update\" the only one that takes group nickname?\n\n - should \"remote update\" the only one? e.g. does \"remote prune\" also\n   take group? if not, shouldn't it?\n"},{"id":"129330","messageId":"20091206145000.GC26440@coredump.intra.peff.net","threadId":"21872","inReplyTo":"1260057623-28960-1-git-send-email-alex@chmrr.net","subject":"Re: [PATCH] Allow --quiet option to git remote, particularly for `git remote update`","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-12-06T14:50:00Z","receivedAt":"2009-12-06T14:50:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Dec 05, 2009 at 07:00:23PM -0500, Alex Vandiver wrote:\n\n> @@ -84,9 +84,12 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not)\n>  static int fetch_remote(const char *name)\n>  {\n>  \tconst char *argv[] = { \"fetch\", name, NULL, NULL };\n> -\tif (verbose) {\n> +\tif (verbosity > 0) {\n>  \t\targv[1] = \"-v\";\n>  \t\targv[2] = name;\n> +\t} else if (verbosity < 0) {\n> +\t\targv[1] = \"-q\";\n> +\t\targv[2] = name;\n>  \t}\n>  \tprintf(\"Updating %s\\n\", name);\n\nShould --quiet also affect this \"Updating %s\" line?\n\nActually, I have often wished for a way to shut up this line but keep\nfetch at its normal verbosity.  Fetch very sanely says nothing if there\nis nothing to update, but you still get this \"Updating\" junk line, even\nif nothing is transferred. But that would probably need an extra\n\"--quiet-remote\" option to handle separately from what we pass to fetch.\n\n-Peff\n"},{"id":"129380","messageId":"1260156352-sup-6170@utwig","threadId":"21872","inReplyTo":"20091206145000.GC26440@coredump.intra.peff.net","subject":"Re: [PATCH] Allow --quiet option to git remote, particularly for `git remote update`","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-12-07T06:15:05Z","receivedAt":"2009-12-07T06:15:05Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"At Sun Dec 06 09:50:00 -0500 2009, Jeff King wrote:\n> Should --quiet also affect this \"Updating %s\" line?\n\nLooking at it more closely, I think this patch should -- but for\nreasons unrelated o your argument below.  The \"Updating %s\" line there\nis in fetch_remote, which is _only_ called during `git remote add -f`.\nIt stands in for the \"Fetching %s\" line which `git fetch` (and `git\nremote update`) outputs, which (after this patch), _is_ controlled by\n--quiet.\n\nThus I feel like \"Updating %s\" should change to \"Fetching %s\" for both\nconsistency and explicitness, and should also be controlled by\n--quiet.  The --quiet-remote option is an entirely different bikeshed,\nwhich I don't have a strong opinion on, offhand.\n\n - Alex\n-- \nNetworking -- only one letter away from not working\n"},{"id":"129381","messageId":"20091207064007.GA3664@coredump.intra.peff.net","threadId":"21872","inReplyTo":"1260156352-sup-6170@utwig","subject":"Re: [PATCH] Allow --quiet option to git remote, particularly for `git remote update`","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-12-07T06:40:07Z","receivedAt":"2009-12-07T06:40:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Dec 07, 2009 at 01:15:05AM -0500, Alex Vandiver wrote:\n\n> At Sun Dec 06 09:50:00 -0500 2009, Jeff King wrote:\n> > Should --quiet also affect this \"Updating %s\" line?\n> \n> Looking at it more closely, I think this patch should -- but for\n> reasons unrelated o your argument below.  The \"Updating %s\" line there\n> is in fetch_remote, which is _only_ called during `git remote add -f`.\n> It stands in for the \"Fetching %s\" line which `git fetch` (and `git\n> remote update`) outputs, which (after this patch), _is_ controlled by\n> --quiet.\n\nAh, sorry, this has actually changed since the last time I looked at it\nclosely, as a result of 9c4a036 (Teach the --all option to 'git fetch',\n2009-11-09). So nevermind my complaint...it has actually been addressed\nseparately (I didn't notice because I have been suppressing the output\nby redirecting stdout for some time).\n\n> Thus I feel like \"Updating %s\" should change to \"Fetching %s\" for both\n> consistency and explicitness, and should also be controlled by\n> --quiet.  The --quiet-remote option is an entirely different bikeshed,\n> which I don't have a strong opinion on, offhand.\n\nYes, I agree (that it should be quieted, and that it should say\n\"Fetching\").  My --quiet-remote argument is now pointless as of\n9c4a036b.\n\n-Peff\n"},{"id":"129384","messageId":"1260169742-sup-9991@utwig","threadId":"21872","inReplyTo":"7vd42soo2p.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Allow --quiet option to git remote, particularly for `git remote update`","fromName":"Alex Vandiver","fromEmail":"alex@chmrr.net","sentAt":"2009-12-07T07:23:13Z","receivedAt":"2009-12-07T07:23:13Z","isPatch":true,"sender":{"key":"alex@chmrr.net","avatar":"https://avatars.githubusercontent.com/u/28347?v=4"},"body":"At Sat Dec 05 21:04:14 -0500 2009, Junio C Hamano wrote:\n> Alex Vandiver <alex@chmrr.net> writes:\n> > ...\n> >      \"git remote prune [-n | --dry-run] <name>\",\n> > -    \"git remote [-v | --verbose] update [-p | --prune] [group | remote]\",\n> > +    \"git remote [-v | --verbose] [-q | --quiet] update [-p | --prune] [group]\",\n\nHm, I hadn't noticed that I'd changed \"[group | remote]\" to \"[group]\".\nI think this is due to a mismerge on my part -- apologies.  As another\ndata point, `git fetch` describes this as \"[<repository> | <group>]\".\n\n> Three issues to consider:\n> \n>  - shouldn't we use the same typography, i.e. <group>?\n> \n>  - should we say <name> _if_ we are not going to say <group>|<remote>?\n> \n>  - should we keep it as <group>|<remote> to make it clear that only this\n>    subcommand allows the group nickname?\n> \n> The first two are easy and I expect the answers to be both yes.  The third\n> one needs some studying and further thought.\n> \n>  - is \"remote update\" the only one that takes group nickname?\n\nMy quick skim of the code says \"yes\" -- the other commands only deal\nwith single remotes at a time, and prune is oblivious to groups.\n\n>  - should \"remote update\" the only one? e.g. does \"remote prune\" also\n>    take group? if not, shouldn't it?\n\nProperly, it \"ought\" to, though I don't see much utility over `git\nremote fetch --prune groupname`.  Probably at the same time, the\nparallel pruning codepaths in builtin-fetch.c:prune_refs() and\nbuiltin-remote.c:prune_remote() should be unified.\n - Alex\n-- \nNetworking -- only one letter away from not working\n"}]}