{"thread":{"id":"22710","subject":"[PATCH 00/10] teach --progress to transport-related builtins","startedAt":"2010-02-18T12:37:01Z","lastAt":"2010-02-19T07:53:50Z","messageCount":16,"participants":["Tay Ray Chuan","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"134953","messageId":"1266496631-3980-1-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":null,"subject":"[PATCH 00/10] teach --progress to transport-related builtins","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:01Z","receivedAt":"2010-02-18T12:37:01Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"This patch series adds --progress to:\n\n  - git-fetch\n  - git-pull\n  - git-push\n\nI suspect the most contentious issue in this patch series would be the\nlogic that determines whether progress reporting is done. This is found\nin patch 6 for transport.c::transport_set_verbosity().\n\nAs a guide, I used Jeff's message (gmane#121065). The rules used are as\nfollows (processing aborts when a rule is satisfied):\n\n  1. Report progress, if force_progress is 1 (ie. --progress).\n  2. Don't report progress, if verbosity < 0 (ie. -q/--quiet).\n  3. Report progress if isatty(2) is 1.\n\nThis changes the current implementation such that if both --progress\nand --quiet are specified, progress is reported. I don't think this is\na very significant change, but I think it makes sense, since I expect\n--progress to be mostly used by script writers or IDE integrators (to\nforce progress reporting even if stderr is not a terminal).\n\nContents:\n\n[PATCH 01/10] Documentation/git-pull.txt: mention --quiet and --verbose for fetching\n[PATCH 02/10] Documentation/git-push.txt: put --quiet before --verbose\n[PATCH 03/10] fetch: refactor verbosity option handling into transport.[ch]\n[PATCH 04/10] push: support multiple levels of verbosity\n[PATCH 05/10] clone: support multiple levels of verbosity\n[PATCH 06/10] transport->progress: use flag authoritatively\n[PATCH 07/10] push: learn --progress\n[PATCH 08/10] fetch: learn --progress\n[PATCH 09/10] pull: learn --progress\n[PATCH 10/10] transport: update flags to be in running order\n\n Documentation/fetch-options.txt |   11 ++++++++---\n Documentation/git-push.txt      |   15 +++++++++++----\n builtin-clone.c                 |   19 ++++++-------------\n builtin-fetch.c                 |    7 +++----\n builtin-push.c                  |   11 ++++++++---\n git-pull.sh                     |    6 ++++--\n transport-helper.c              |    4 +---\n transport.c                     |   31 ++++++++++++++++++++++++++-----\n transport.h                     |   15 ++++++++++-----\n 9 files changed, 77 insertions(+), 42 deletions(-)\n\n--\nCheers,\nRay Chuan\n"},{"id":"134954","messageId":"1266496631-3980-2-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 01/10] Documentation/git-pull.txt: mention --quiet and --verbose for fetching","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:02Z","receivedAt":"2010-02-18T12:37:02Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"This reverts 90e4311 (git-pull: do not mention --quiet and --verbose\ntwice, Mon Sep 7 2009).\n\nThen, the subtitles \"Options related to merging\" and \"Options related to\nfetching\" weren't present, and the options for git-merge and git-fetch\noptions were in a monolithic block.\n\nAfter 3f7a9b5 (Documentation/git-pull.txt: Add subtitles above included\noption files, Thu Oct 22 2009), it is ok to repeat options in the\nsame document, since they are distinguished between those for git-merge\nand git-fetch.\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n Documentation/fetch-options.txt |    2 --\n 1 files changed, 0 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt\nindex fe716b2..83606f4 100644\n--- a/Documentation/fetch-options.txt\n+++ b/Documentation/fetch-options.txt\n@@ -74,7 +74,6 @@ endif::git-pull[]\n \tthe command to specify non-default path for the command\n \trun on the other end.\n \n-ifndef::git-pull[]\n -q::\n --quiet::\n \tPass --quiet to git-fetch-pack and silence any other internally\n@@ -83,4 +82,3 @@ ifndef::git-pull[]\n -v::\n --verbose::\n \tBe verbose.\n-endif::git-pull[]\n-- \n1.7.0.27.g5d71b\n"},{"id":"134956","messageId":"1266496631-3980-3-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 02/10] Documentation/git-push.txt: put --quiet before --verbose","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:03Z","receivedAt":"2010-02-18T12:37:03Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n Documentation/git-push.txt |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex bd79119..22cff99 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -145,15 +145,15 @@ useful if you write an alias or script around 'git push'.\n \ttransfer spends extra cycles to minimize the number of\n \tobjects to be sent and meant to be used on slower connection.\n \n--v::\n---verbose::\n-\tRun verbosely.\n-\n -q::\n --quiet::\n \tSuppress all output, including the listing of updated refs,\n \tunless an error occurs.\n \n+-v::\n+--verbose::\n+\tRun verbosely.\n+\n include::urls-remotes.txt[]\n \n OUTPUT\n-- \n1.7.0.27.g5d71b\n"},{"id":"134955","messageId":"1266496631-3980-4-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 03/10] fetch: refactor verbosity option handling into transport.[ch]","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:04Z","receivedAt":"2010-02-18T12:37:04Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"transport_set_verbosity() is now provided to transport users.\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n builtin-fetch.c |    5 +----\n transport.c     |    8 ++++++++\n transport.h     |    1 +\n 3 files changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex 8654fa7..d23ea2a 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -823,10 +823,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n \t\tdie(\"Where do you want to fetch from today?\");\n \n \ttransport = transport_get(remote, NULL);\n-\tif (verbosity >= 2)\n-\t\ttransport->verbose = verbosity <= 3 ? verbosity : 3;\n-\tif (verbosity < 0)\n-\t\ttransport->verbose = -1;\n+\ttransport_set_verbosity(transport, verbosity);\n \tif (upload_pack)\n \t\tset_option(TRANS_OPT_UPLOADPACK, upload_pack);\n \tif (keep)\ndiff --git a/transport.c b/transport.c\nindex 3846aac..1632c4d 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1013,6 +1013,14 @@ int transport_set_option(struct transport *transport,\n \treturn 1;\n }\n \n+void transport_set_verbosity(struct transport *transport, int verbosity)\n+{\n+\tif (verbosity >= 2)\n+\t\ttransport->verbose = verbosity <= 3 ? verbosity : 3;\n+\tif (verbosity < 0)\n+\t\ttransport->verbose = -1;\n+}\n+\n int transport_push(struct transport *transport,\n \t\t   int refspec_nr, const char **refspec, int flags,\n \t\t   int *nonfastforward)\ndiff --git a/transport.h b/transport.h\nindex 7cea5cc..7d1a0b6 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -122,6 +122,7 @@ struct transport *transport_get(struct remote *, const char *);\n  **/\n int transport_set_option(struct transport *transport, const char *name,\n \t\t\t const char *value);\n+void transport_set_verbosity(struct transport *transport, int verbosity);\n \n int transport_push(struct transport *connection,\n \t\t   int refspec_nr, const char **refspec, int flags,\n-- \n1.7.0.27.g5d71b\n"},{"id":"134960","messageId":"1266496631-3980-5-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 04/10] push: support multiple levels of verbosity","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:05Z","receivedAt":"2010-02-18T12:37:05Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Remove the flags TRANSPORT_PUSH_QUIET and TRANSPORT_PUSH_VERBOSE; use\ntransport->verbose instead to determine verbosity for pushing.\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n builtin-push.c     |    9 ++++++---\n transport-helper.c |    1 -\n transport.c        |    8 ++++----\n transport.h        |    2 --\n 4 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin-push.c b/builtin-push.c\nindex 5633f0a..0082dad 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -17,6 +17,7 @@ static const char * const push_usage[] = {\n static int thin;\n static int deleterefs;\n static const char *receivepack;\n+static int verbosity;\n \n static const char **refspec;\n static int refspec_nr;\n@@ -105,13 +106,16 @@ static int push_with_options(struct transport *transport, int flags)\n {\n \tint err;\n \tint nonfastforward;\n+\n+\ttransport_set_verbosity(transport, verbosity);\n+\n \tif (receivepack)\n \t\ttransport_set_option(transport,\n \t\t\t\t     TRANS_OPT_RECEIVEPACK, receivepack);\n \tif (thin)\n \t\ttransport_set_option(transport, TRANS_OPT_THIN, \"yes\");\n \n-\tif (flags & TRANSPORT_PUSH_VERBOSE)\n+\tif (verbosity > 0)\n \t\tfprintf(stderr, \"Pushing to %s\\n\", transport->url);\n \terr = transport_push(transport, refspec_nr, refspec, flags,\n \t\t\t     &nonfastforward);\n@@ -204,8 +208,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)\n \tint rc;\n \tconst char *repo = NULL;\t/* default repository */\n \tstruct option options[] = {\n-\t\tOPT_BIT('q', \"quiet\", &flags, \"be quiet\", TRANSPORT_PUSH_QUIET),\n-\t\tOPT_BIT('v', \"verbose\", &flags, \"be verbose\", TRANSPORT_PUSH_VERBOSE),\n+\t\tOPT__VERBOSITY(&verbosity),\n \t\tOPT_STRING( 0 , \"repo\", &repo, \"repository\", \"repository\"),\n \t\tOPT_BIT( 0 , \"all\", &flags, \"push all refs\", TRANSPORT_PUSH_ALL),\n \t\tOPT_BIT( 0 , \"mirror\", &flags, \"mirror all refs\",\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 1077428..3d33697 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -576,7 +576,6 @@ static int push_refs(struct transport *transport,\n \tif (buf.len == 0)\n \t\treturn 0;\n \n-\ttransport->verbose = flags & TRANSPORT_PUSH_VERBOSE ? 1 : 0;\n \tstandard_options(transport);\n \n \tif (flags & TRANSPORT_PUSH_DRY_RUN) {\ndiff --git a/transport.c b/transport.c\nindex 1632c4d..0655f65 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -788,8 +788,8 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re\n \targs.send_mirror = !!(flags & TRANSPORT_PUSH_MIRROR);\n \targs.force_update = !!(flags & TRANSPORT_PUSH_FORCE);\n \targs.use_thin_pack = data->options.thin;\n-\targs.verbose = !!(flags & TRANSPORT_PUSH_VERBOSE);\n-\targs.quiet = !!(flags & TRANSPORT_PUSH_QUIET);\n+\targs.verbose = (transport->verbose > 0);\n+\targs.quiet = (transport->verbose < 0);\n \targs.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN);\n \n \tret = send_pack(&args, data->fd, data->conn, remote_refs,\n@@ -1039,8 +1039,8 @@ int transport_push(struct transport *transport,\n \t\t\ttransport->get_refs_list(transport, 1);\n \t\tstruct ref *local_refs = get_local_heads();\n \t\tint match_flags = MATCH_REFS_NONE;\n-\t\tint verbose = flags & TRANSPORT_PUSH_VERBOSE;\n-\t\tint quiet = flags & TRANSPORT_PUSH_QUIET;\n+\t\tint verbose = (transport->verbose > 0);\n+\t\tint quiet = (transport->verbose < 0);\n \t\tint porcelain = flags & TRANSPORT_PUSH_PORCELAIN;\n \t\tint pretend = flags & TRANSPORT_PUSH_DRY_RUN;\n \t\tint ret, err;\ndiff --git a/transport.h b/transport.h\nindex 7d1a0b6..c0743b1 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -88,9 +88,7 @@ struct transport {\n #define TRANSPORT_PUSH_FORCE 2\n #define TRANSPORT_PUSH_DRY_RUN 4\n #define TRANSPORT_PUSH_MIRROR 8\n-#define TRANSPORT_PUSH_VERBOSE 16\n #define TRANSPORT_PUSH_PORCELAIN 32\n-#define TRANSPORT_PUSH_QUIET 64\n #define TRANSPORT_PUSH_SET_UPSTREAM 128\n \n /* Returns a transport suitable for the url */\n-- \n1.7.0.27.g5d71b\n"},{"id":"134962","messageId":"1266496631-3980-6-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 05/10] clone: support multiple levels of verbosity","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:06Z","receivedAt":"2010-02-18T12:37:06Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n builtin-clone.c |   16 ++++++----------\n 1 files changed, 6 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin-clone.c b/builtin-clone.c\nindex 58bacbd..959fe4b 100644\n--- a/builtin-clone.c\n+++ b/builtin-clone.c\n@@ -37,18 +37,17 @@ static const char * const builtin_clone_usage[] = {\n \tNULL\n };\n \n-static int option_quiet, option_no_checkout, option_bare, option_mirror;\n+static int option_no_checkout, option_bare, option_mirror;\n static int option_local, option_no_hardlinks, option_shared, option_recursive;\n static char *option_template, *option_reference, *option_depth;\n static char *option_origin = NULL;\n static char *option_branch = NULL;\n static char *option_upload_pack = \"git-upload-pack\";\n-static int option_verbose;\n+static int option_verbosity;\n static int option_progress;\n \n static struct option builtin_clone_options[] = {\n-\tOPT__QUIET(&option_quiet),\n-\tOPT__VERBOSE(&option_verbose),\n+\tOPT__VERBOSITY(&option_verbosity),\n \tOPT_BOOLEAN(0, \"progress\", &option_progress,\n \t\t\t\"force progress reporting\"),\n \tOPT_BOOLEAN('n', \"no-checkout\", &option_no_checkout,\n@@ -462,7 +461,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\tdie(\"could not create leading directories of '%s'\", git_dir);\n \tset_git_dir(make_absolute_path(git_dir));\n \n-\tinit_db(option_template, option_quiet ? INIT_DB_QUIET : 0);\n+\tinit_db(option_template, (option_verbosity < 0) ? INIT_DB_QUIET : 0);\n \n \t/*\n \t * At this point, the config exists, so we do not need the\n@@ -526,10 +525,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\t\ttransport_set_option(transport, TRANS_OPT_DEPTH,\n \t\t\t\t\t     option_depth);\n \n-\t\tif (option_quiet)\n-\t\t\ttransport->verbose = -1;\n-\t\telse if (option_verbose)\n-\t\t\ttransport->verbose = 1;\n+\t\ttransport_set_verbosity(transport, option_verbosity);\n \n \t\tif (option_progress)\n \t\t\ttransport->progress = 1;\n@@ -641,7 +637,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\topts.update = 1;\n \t\topts.merge = 1;\n \t\topts.fn = oneway_merge;\n-\t\topts.verbose_update = !option_quiet;\n+\t\topts.verbose_update = (option_verbosity > 0);\n \t\topts.src_index = &the_index;\n \t\topts.dst_index = &the_index;\n \n-- \n1.7.0.27.g5d71b\n"},{"id":"134957","messageId":"1266496631-3980-7-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 06/10] transport->progress: use flag authoritatively","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:07Z","receivedAt":"2010-02-18T12:37:07Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Set transport->progress in transport.c::transport_set_verbosity() after\nchecking for the appropriate conditions (eg. --progress, isatty(2)),\nand thereafter use it without having to check again.\n\nThe rules used are as follows (processing aborts when a rule is\nsatisfied):\n\n  1. Report progress, if force_progress is 1 (ie. --progress).\n  2. Don't report progress, if verbosity < 0 (ie. -q/--quiet).\n  3. Report progress if isatty(2) is 1.\n\nThis changes progress reporting behaviour such that if both --progress\nand --quiet are specified, progress is reported.\n\nIn two areas, the logic to determine whether to *not* show progress is\nchanged to simply use the negation of transport->progress. This changes\nbehaviour in some ways (see previous paragraph for details).\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n builtin-clone.c    |    5 +----\n builtin-fetch.c    |    2 +-\n builtin-push.c     |    2 +-\n transport-helper.c |    3 +--\n transport.c        |   17 +++++++++++++++--\n transport.h        |   10 ++++++++--\n 6 files changed, 27 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin-clone.c b/builtin-clone.c\nindex 959fe4b..05f8fb4 100644\n--- a/builtin-clone.c\n+++ b/builtin-clone.c\n@@ -525,10 +525,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\t\ttransport_set_option(transport, TRANS_OPT_DEPTH,\n \t\t\t\t\t     option_depth);\n \n-\t\ttransport_set_verbosity(transport, option_verbosity);\n-\n-\t\tif (option_progress)\n-\t\t\ttransport->progress = 1;\n+\t\ttransport_set_verbosity(transport, option_verbosity, option_progress);\n \n \t\tif (option_upload_pack)\n \t\t\ttransport_set_option(transport, TRANS_OPT_UPLOADPACK,\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex d23ea2a..6b96b41 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -823,7 +823,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n \t\tdie(\"Where do you want to fetch from today?\");\n \n \ttransport = transport_get(remote, NULL);\n-\ttransport_set_verbosity(transport, verbosity);\n+\ttransport_set_verbosity(transport, verbosity, 0);\n \tif (upload_pack)\n \t\tset_option(TRANS_OPT_UPLOADPACK, upload_pack);\n \tif (keep)\ndiff --git a/builtin-push.c b/builtin-push.c\nindex 0082dad..dce3152 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -107,7 +107,7 @@ static int push_with_options(struct transport *transport, int flags)\n \tint err;\n \tint nonfastforward;\n \n-\ttransport_set_verbosity(transport, verbosity);\n+\ttransport_set_verbosity(transport, verbosity, 0);\n \n \tif (receivepack)\n \t\ttransport_set_option(transport,\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 3d33697..3e69ebd 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -279,9 +279,8 @@ static void standard_options(struct transport *t)\n \tchar buf[16];\n \tint n;\n \tint v = t->verbose;\n-\tint no_progress = v < 0 || (!t->progress && !isatty(2));\n \n-\tset_helper_option(t, \"progress\", !no_progress ? \"true\" : \"false\");\n+\tset_helper_option(t, \"progress\", t->progress ? \"true\" : \"false\");\n \n \tn = snprintf(buf, sizeof(buf), \"%d\", v + 1);\n \tif (n >= sizeof(buf))\ndiff --git a/transport.c b/transport.c\nindex 0655f65..e2cfabd 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -526,7 +526,7 @@ static int fetch_refs_via_pack(struct transport *transport,\n \targs.include_tag = data->options.followtags;\n \targs.verbose = (transport->verbose > 0);\n \targs.quiet = (transport->verbose < 0);\n-\targs.no_progress = args.quiet || (!transport->progress && !isatty(2));\n+\targs.no_progress = !transport->progress;\n \targs.depth = data->options.depth;\n \n \tfor (i = 0; i < nr_heads; i++)\n@@ -915,6 +915,8 @@ struct transport *transport_get(struct remote *remote, const char *url)\n \tconst char *helper;\n \tstruct transport *ret = xcalloc(1, sizeof(*ret));\n \n+\tret->progress = isatty(2);\n+\n \tif (!remote)\n \t\tdie(\"No remote provided to transport_get()\");\n \n@@ -1013,12 +1015,23 @@ int transport_set_option(struct transport *transport,\n \treturn 1;\n }\n \n-void transport_set_verbosity(struct transport *transport, int verbosity)\n+void transport_set_verbosity(struct transport *transport, int verbosity,\n+\tint force_progress)\n {\n \tif (verbosity >= 2)\n \t\ttransport->verbose = verbosity <= 3 ? verbosity : 3;\n \tif (verbosity < 0)\n \t\ttransport->verbose = -1;\n+\n+\t/**\n+\t * Rules used to determine whether to report progress (processing aborts\n+\t * when a rule is satisfied):\n+\t *\n+\t *   1. Report progress, if force_progress is 1 (ie. --progress).\n+\t *   2. Don't report progress, if verbosity < 0 (ie. -q/--quiet ).\n+\t *   3. Report progress if isatty(2) is 1.\n+\t **/\n+\ttransport->progress = force_progress || (verbosity >= 0 && isatty(2));\n }\n \n int transport_push(struct transport *transport,\ndiff --git a/transport.h b/transport.h\nindex c0743b1..de2745a 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -74,7 +74,12 @@ struct transport {\n \tint (*disconnect)(struct transport *connection);\n \tchar *pack_lockfile;\n \tsigned verbose : 3;\n-\t/* Force progress even if stderr is not a tty */\n+\t/**\n+\t * Transports should not set this directly, and should use this\n+\t * value without having to check isatty(2), -q/--quiet\n+\t * (transport->verbose < 0), etc. - checking has already been done\n+\t * in transport_set_verbosity().\n+\t **/\n \tunsigned progress : 1;\n \t/*\n \t * If transport is at least potentially smart, this points to\n@@ -120,7 +125,8 @@ struct transport *transport_get(struct remote *, const char *);\n  **/\n int transport_set_option(struct transport *transport, const char *name,\n \t\t\t const char *value);\n-void transport_set_verbosity(struct transport *transport, int verbosity);\n+void transport_set_verbosity(struct transport *transport, int verbosity,\n+\tint force_progress);\n \n int transport_push(struct transport *connection,\n \t\t   int refspec_nr, const char **refspec, int flags,\n-- \n1.7.0.27.g5d71b\n"},{"id":"134961","messageId":"1266496631-3980-8-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 07/10] push: learn --progress","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:08Z","receivedAt":"2010-02-18T12:37:08Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n Documentation/git-push.txt |    9 ++++++++-\n builtin-push.c             |    4 +++-\n 2 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex 22cff99..8d95724 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -148,12 +148,19 @@ useful if you write an alias or script around 'git push'.\n -q::\n --quiet::\n \tSuppress all output, including the listing of updated refs,\n-\tunless an error occurs.\n+\tunless an error occurs. Progress is not reported to the standard\n+\terror stream.\n \n -v::\n --verbose::\n \tRun verbosely.\n \n+--progress::\n+\tProgress status is reported on the standard error stream\n+\tby default when it is attached to a terminal, unless -q\n+\tis specified. This flag forces progress status even if the\n+\tstandard error stream is not directed to a terminal.\n+\n include::urls-remotes.txt[]\n \n OUTPUT\ndiff --git a/builtin-push.c b/builtin-push.c\nindex dce3152..ba9fe49 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -18,6 +18,7 @@ static int thin;\n static int deleterefs;\n static const char *receivepack;\n static int verbosity;\n+static int progress;\n \n static const char **refspec;\n static int refspec_nr;\n@@ -107,7 +108,7 @@ static int push_with_options(struct transport *transport, int flags)\n \tint err;\n \tint nonfastforward;\n \n-\ttransport_set_verbosity(transport, verbosity, 0);\n+\ttransport_set_verbosity(transport, verbosity, progress);\n \n \tif (receivepack)\n \t\ttransport_set_option(transport,\n@@ -223,6 +224,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)\n \t\tOPT_STRING( 0 , \"exec\", &receivepack, \"receive-pack\", \"receive pack program\"),\n \t\tOPT_BIT('u', \"set-upstream\", &flags, \"set upstream for git pull/status\",\n \t\t\tTRANSPORT_PUSH_SET_UPSTREAM),\n+\t\tOPT_BOOLEAN(0, \"progress\", &progress, \"force progress reporting\"),\n \t\tOPT_END()\n \t};\n \n-- \n1.7.0.27.g5d71b\n"},{"id":"134959","messageId":"1266496631-3980-9-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 08/10] fetch: learn --progress","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:09Z","receivedAt":"2010-02-18T12:37:09Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n Documentation/fetch-options.txt |    9 ++++++++-\n builtin-fetch.c                 |    4 +++-\n 2 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt\nindex 83606f4..db1ea25 100644\n--- a/Documentation/fetch-options.txt\n+++ b/Documentation/fetch-options.txt\n@@ -77,8 +77,15 @@ endif::git-pull[]\n -q::\n --quiet::\n \tPass --quiet to git-fetch-pack and silence any other internally\n-\tused git commands.\n+\tused git commands. Progress is not reported to the standard error\n+\tstream.\n \n -v::\n --verbose::\n \tBe verbose.\n+\n+--progress::\n+\tProgress status is reported on the standard error stream\n+\tby default when it is attached to a terminal, unless -q\n+\tis specified. This flag forces progress status even if the\n+\tstandard error stream is not directed to a terminal.\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex 6b96b41..7f9f669 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -27,6 +27,7 @@ enum {\n };\n \n static int all, append, dry_run, force, keep, multiple, prune, update_head_ok, verbosity;\n+static int progress;\n static int tags = TAGS_DEFAULT;\n static const char *depth;\n static const char *upload_pack;\n@@ -56,6 +57,7 @@ static struct option builtin_fetch_options[] = {\n \tOPT_BOOLEAN('k', \"keep\", &keep, \"keep downloaded pack\"),\n \tOPT_BOOLEAN('u', \"update-head-ok\", &update_head_ok,\n \t\t    \"allow updating of HEAD ref\"),\n+\tOPT_BOOLEAN(0, \"progress\", &progress, \"force progress reporting\"),\n \tOPT_STRING(0, \"depth\", &depth, \"DEPTH\",\n \t\t   \"deepen history of shallow clone\"),\n \tOPT_END()\n@@ -823,7 +825,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n \t\tdie(\"Where do you want to fetch from today?\");\n \n \ttransport = transport_get(remote, NULL);\n-\ttransport_set_verbosity(transport, verbosity, 0);\n+\ttransport_set_verbosity(transport, verbosity, progress);\n \tif (upload_pack)\n \t\tset_option(TRANS_OPT_UPLOADPACK, upload_pack);\n \tif (keep)\n-- \n1.7.0.27.g5d71b\n"},{"id":"134964","messageId":"1266496631-3980-10-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 09/10] pull: learn --progress","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:10Z","receivedAt":"2010-02-18T12:37:10Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n git-pull.sh |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 38331a8..d45b50c 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -38,7 +38,7 @@ test -z \"$(git ls-files -u)\" || die_conflict\n test -f \"$GIT_DIR/MERGE_HEAD\" && die_merge\n \n strategy_args= diffstat= no_commit= squash= no_ff= ff_only=\n-log_arg= verbosity=\n+log_arg= verbosity= progress=\n merge_args=\n curr_branch=$(git symbolic-ref -q HEAD)\n curr_branch_short=$(echo \"$curr_branch\" | sed \"s|refs/heads/||\")\n@@ -50,6 +50,8 @@ do\n \t\tverbosity=\"$verbosity -q\" ;;\n \t-v|--verbose)\n \t\tverbosity=\"$verbosity -v\" ;;\n+\t--progress)\n+\t\tprogress=--progress ;;\n \t-n|--no-stat|--no-summary)\n \t\tdiffstat=--no-stat ;;\n \t--stat|--summary)\n@@ -214,7 +216,7 @@ test true = \"$rebase\" && {\n \tdone\n }\n orig_head=$(git rev-parse -q --verify HEAD)\n-git fetch $verbosity --update-head-ok \"$@\" || exit 1\n+git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n \n curr_head=$(git rev-parse -q --verify HEAD)\n if test -n \"$orig_head\" && test \"$curr_head\" != \"$orig_head\"\n-- \n1.7.0.27.g5d71b\n"},{"id":"134958","messageId":"1266496631-3980-11-git-send-email-rctay89@gmail.com","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"[PATCH 10/10] transport: update flags to be in running order","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-18T12:37:11Z","receivedAt":"2010-02-18T12:37:11Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n transport.h |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/transport.h b/transport.h\nindex de2745a..d9bbabb 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -93,8 +93,8 @@ struct transport {\n #define TRANSPORT_PUSH_FORCE 2\n #define TRANSPORT_PUSH_DRY_RUN 4\n #define TRANSPORT_PUSH_MIRROR 8\n-#define TRANSPORT_PUSH_PORCELAIN 32\n-#define TRANSPORT_PUSH_SET_UPSTREAM 128\n+#define TRANSPORT_PUSH_PORCELAIN 16\n+#define TRANSPORT_PUSH_SET_UPSTREAM 32\n \n /* Returns a transport suitable for the url */\n struct transport *transport_get(struct remote *, const char *);\n-- \n1.7.0.27.g5d71b\n"},{"id":"135010","messageId":"7vhbpe5jvo.fsf@alter.siamese.dyndns.org","threadId":"22710","inReplyTo":"1266496631-3980-2-git-send-email-rctay89@gmail.com","subject":"Re: [PATCH 01/10] Documentation/git-pull.txt: mention --quiet and --verbose for fetching","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-18T21:11:55Z","receivedAt":"2010-02-18T21:11:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tay Ray Chuan <rctay89@gmail.com> writes:\n\n> This reverts 90e4311 (git-pull: do not mention --quiet and --verbose\n> twice, Mon Sep 7 2009).\n>\n> Then, the subtitles \"Options related to merging\" and \"Options related to\n> fetching\" weren't present, and the options for git-merge and git-fetch\n> options were in a monolithic block.\n>\n> After 3f7a9b5 (Documentation/git-pull.txt: Add subtitles above included\n> option files, Thu Oct 22 2009), it is ok to repeat options in the\n> same document, since they are distinguished between those for git-merge\n> and git-fetch.\n>\n> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>\n\nAs the result of the change history, currently we mention -q/-v as if it\nonly applies to the invocation of merge, giving an incorrect impression\nthat they won't affect the invocation of fetch.\n\nWhile I agree that is a valid issue to address, I am not sure if repeating\nthese in two sections is a good solution.  A reader will start scanning\nthe OPTIONS section, finds -q (or -v) and notices it is listed in the\n\"related to merging\" subsection, and would stop there.  This change would\nnot help such a reader.\n\nIt may make more sense to list the options that affects both fetch and\nmerge at the beginning of the OPTIONS section before the merge/fetch\nsubsections.  IOW, instead of removing ifndef::git-pull[] like your patch\ndid, it would add ifndef::git-pull[] in the list of options on the merge\nside, and add pull specific description (e.g. \"this is passed to both\nunderlying fetch to squelch progress output of transfer, and underlying\nmerge to squelch the output during the merging\") in git-pull.txt.\n\n>  Documentation/fetch-options.txt |    2 --\n>  1 files changed, 0 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt\n> index fe716b2..83606f4 100644\n> --- a/Documentation/fetch-options.txt\n> +++ b/Documentation/fetch-options.txt\n> @@ -74,7 +74,6 @@ endif::git-pull[]\n>  \tthe command to specify non-default path for the command\n>  \trun on the other end.\n>  \n> -ifndef::git-pull[]\n>  -q::\n>  --quiet::\n>  \tPass --quiet to git-fetch-pack and silence any other internally\n> @@ -83,4 +82,3 @@ ifndef::git-pull[]\n>  -v::\n>  --verbose::\n>  \tBe verbose.\n> -endif::git-pull[]\n> -- \n> 1.7.0.27.g5d71b\n"},{"id":"135030","messageId":"7veikiyq1h.fsf@alter.siamese.dyndns.org","threadId":"22710","inReplyTo":"1266496631-3980-1-git-send-email-rctay89@gmail.com","subject":"Re: [PATCH 00/10] teach --progress to transport-related builtins","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-19T01:26:02Z","receivedAt":"2010-02-19T01:26:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tay Ray Chuan <rctay89@gmail.com> writes:\n\n> This patch series adds --progress to:\n>\n>   - git-fetch\n>   - git-pull\n>   - git-push\n>\n> I suspect the most contentious issue in this patch series would be the\n> logic that determines whether progress reporting is done. This is found\n> in patch 6 for transport.c::transport_set_verbosity().\n>\n> As a guide, I used Jeff's message (gmane#121065). The rules used are as\n> follows (processing aborts when a rule is satisfied):\n>\n>   1. Report progress, if force_progress is 1 (ie. --progress).\n>   2. Don't report progress, if verbosity < 0 (ie. -q/--quiet).\n>   3. Report progress if isatty(2) is 1.\n>\n> This changes the current implementation such that if both --progress\n> and --quiet are specified, progress is reported. I don't think this is\n> a very significant change, but I think it makes sense, since I expect\n> --progress to be mostly used by script writers or IDE integrators (to\n> force progress reporting even if stderr is not a terminal).\n\nI gave a cursory look and they all looked sensible (except for 1/10\non which I already commented separately).  Thanks.\n"},{"id":"135043","messageId":"be6fef0d1002182231t56d04b89h8910dce5cbed3f@mail.gmail.com","threadId":"22710","inReplyTo":"7vhbpe5jvo.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 01/10] Documentation/git-pull.txt: mention --quiet and --verbose for fetching","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-19T06:31:16Z","receivedAt":"2010-02-19T06:31:16Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Hi,\n\nOn Fri, Feb 19, 2010 at 5:11 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> It may make more sense to list the options that affects both fetch and\n> merge at the beginning of the OPTIONS section before the merge/fetch\n> subsections.  IOW, instead of removing ifndef::git-pull[] like your patch\n> did, it would add ifndef::git-pull[] in the list of options on the merge\n> side, and add pull specific description (e.g. \"this is passed to both\n> underlying fetch to squelch progress output of transfer, and underlying\n> merge to squelch the output during the merging\") in git-pull.txt.\n\nI considered adding a \"common options\" section too, but wasn't sure.\nI'll take your suggestion on this.\n\n-- \nCheers,\nRay Chuan\n"},{"id":"135044","messageId":"be6fef0d1002182231r5e300eadgcf2dbea4c2f14c3a@mail.gmail.com","threadId":"22710","inReplyTo":"7veikiyq1h.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 00/10] teach --progress to transport-related builtins","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-02-19T06:31:31Z","receivedAt":"2010-02-19T06:31:31Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Hi,\n\nOn Fri, Feb 19, 2010 at 9:26 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> I gave a cursory look and they all looked sensible (except for 1/10\n> on which I already commented separately).  Thanks.\n\nok. I'll sit on this series for a while for more comments to come in\nbefore I send out the next iteration.\n\n-- \nCheers,\nRay Chuan\n"},{"id":"135058","messageId":"20100219075350.GA12964@coredump.intra.peff.net","threadId":"22710","inReplyTo":"be6fef0d1002182231r5e300eadgcf2dbea4c2f14c3a@mail.gmail.com","subject":"Re: [PATCH 00/10] teach --progress to transport-related builtins","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-02-19T07:53:50Z","receivedAt":"2010-02-19T07:53:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 19, 2010 at 02:31:31PM +0800, Tay Ray Chuan wrote:\n\n> Hi,\n> \n> On Fri, Feb 19, 2010 at 9:26 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> > I gave a cursory look and they all looked sensible (except for 1/10\n> > on which I already commented separately).  Thanks.\n> \n> ok. I'll sit on this series for a while for more comments to come in\n> before I send out the next iteration.\n\nI read it over and it looked OK, except for Junio's comments.\n\n-Peff\n"}]}