{"thread":{"id":"15777","subject":"Forcing progerss output for clone","startedAt":"2008-10-03T20:01:14Z","lastAt":"2008-10-09T21:26:44Z","messageCount":11,"participants":["Constantine Plotnikov","Alex Riesen","Miklos Vajna","Shawn O. Pearce","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"92272","messageId":"85647ef50810031301k641c5f24n65fb213c2b481e7@mail.gmail.com","threadId":"15777","inReplyTo":null,"subject":"Forcing progerss output for clone","fromName":"Constantine Plotnikov","fromEmail":"constantine.plotnikov@gmail.com","sentAt":"2008-10-03T20:01:14Z","receivedAt":"2008-10-03T20:01:14Z","isPatch":false,"sender":{"key":"constantine.plotnikov@gmail.com","avatar":null},"body":"Hello!\n\nIs there a way to force a progress output on stderr for git clone\npreferably using options or environment variables?\n\nThe clone command in the git 1.6.0.2 does not print a progress\ninformation to stderr if stdout and stderr are redirected (even if no\n\"-q\" option is specified).\n\nSuch information would have been useful for displaying progress\ninformation when cloning from IDE. IDE run git with streams\nredirected, and this progress information could have been displayed to\nuser to indicate current status of operation.\n\nBest Regards,\nConstantine\n"},{"id":"92303","messageId":"81b0412b0810041442i3aa29628lf66ef9b188fe8ce7@mail.gmail.com","threadId":"15777","inReplyTo":"85647ef50810031301k641c5f24n65fb213c2b481e7@mail.gmail.com","subject":"Re: Forcing progerss output for clone","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-10-04T21:42:15Z","receivedAt":"2008-10-04T21:42:15Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/10/3 Constantine Plotnikov <constantine.plotnikov@gmail.com>:\n> Is there a way to force a progress output on stderr for git clone\n> preferably using options or environment variables?\n\nNo, but \"-v\" option is not used for anything yet, so you are free to\nimplement it.\n"},{"id":"92460","messageId":"1223331590-22138-1-git-send-email-vmiklos@frugalware.org","threadId":"15777","inReplyTo":"81b0412b0810041442i3aa29628lf66ef9b188fe8ce7@mail.gmail.com","subject":"[PATCH] Implement git clone -v","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-10-06T22:19:50Z","receivedAt":"2008-10-06T22:19:50Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"The new -v option forces the progressbar, even in case the output is not\na terminal.\n\nSigned-off-by: Miklos Vajna <vmiklos@frugalware.org>\n---\n\nOn Sat, Oct 04, 2008 at 11:42:15PM +0200, Alex Riesen <raa.lkml@gmail.com> wrote:\n> 2008/10/3 Constantine Plotnikov <constantine.plotnikov@gmail.com>:\n> > Is there a way to force a progress output on stderr for git clone\n> > preferably using options or environment variables?\n>\n> No, but \"-v\" option is not used for anything yet, so you are free to\n> implement it.\n\nSomething like this?\n\n Documentation/git-clone.txt |    5 +++++\n builtin-clone.c             |    4 ++++\n transport.c                 |    2 +-\n transport.h                 |    2 ++\n 4 files changed, 12 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex 0e14e73..95f08b9 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -90,6 +90,11 @@ then the cloned repository will become corrupt.\n \tOperate quietly.  This flag is also passed to the `rsync'\n \tcommand when given.\n \n+--verbose::\n+-v::\n+\tDisplay the progressbar, even in case the standard output is not\n+\ta terminal.\n+\n --no-checkout::\n -n::\n \tNo checkout of HEAD is performed after the clone is complete.\ndiff --git a/builtin-clone.c b/builtin-clone.c\nindex 49d2eb9..df71b23 100644\n--- a/builtin-clone.c\n+++ b/builtin-clone.c\n@@ -38,9 +38,11 @@ static int option_local, option_no_hardlinks, option_shared;\n static char *option_template, *option_reference, *option_depth;\n static char *option_origin = NULL;\n static char *option_upload_pack = \"git-upload-pack\";\n+static int option_verbose;\n \n static struct option builtin_clone_options[] = {\n \tOPT__QUIET(&option_quiet),\n+\tOPT__VERBOSE(&option_verbose),\n \tOPT_BOOLEAN('n', \"no-checkout\", &option_no_checkout,\n \t\t    \"don't create a checkout\"),\n \tOPT_BOOLEAN(0, \"bare\", &option_bare, \"create a bare repository\"),\n@@ -506,6 +508,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \n \t\tif (option_quiet)\n \t\t\ttransport->verbose = -1;\n+\t\telse if (option_verbose)\n+\t\t\ttransport->progress = 1;\n \n \t\tif (option_upload_pack)\n \t\t\ttransport_set_option(transport, TRANS_OPT_UPLOADPACK,\ndiff --git a/transport.c b/transport.c\nindex 5110c56..1c510a3 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -644,7 +644,7 @@ static int fetch_refs_via_pack(struct transport *transport,\n \targs.include_tag = data->followtags;\n \targs.verbose = (transport->verbose > 0);\n \targs.quiet = (transport->verbose < 0);\n-\targs.no_progress = args.quiet || !isatty(1);\n+\targs.no_progress = args.quiet || (!transport->progress && !isatty(1));\n \targs.depth = data->depth;\n \n \tfor (i = 0; i < nr_heads; i++)\ndiff --git a/transport.h b/transport.h\nindex d0b5205..6bbc1a8 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -25,6 +25,8 @@ struct transport {\n \tint (*disconnect)(struct transport *connection);\n \tchar *pack_lockfile;\n \tsigned verbose : 2;\n+\t/* Force progress even if the output is not a tty */\n+\tunsigned progress : 1;\n };\n \n #define TRANSPORT_PUSH_ALL 1\n-- \n1.6.0.2\n"},{"id":"92494","messageId":"81b0412b0810062321h33abe076kd87b60bffdaf218b@mail.gmail.com","threadId":"15777","inReplyTo":"1223331590-22138-1-git-send-email-vmiklos@frugalware.org","subject":"Re: [PATCH] Implement git clone -v","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-10-07T06:21:28Z","receivedAt":"2008-10-07T06:21:28Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/10/7 Miklos Vajna <vmiklos@frugalware.org>:\n> The new -v option forces the progressbar, even in case the output is not\n> a terminal.\n>\n> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>\n> ---\n>\n> On Sat, Oct 04, 2008 at 11:42:15PM +0200, Alex Riesen <raa.lkml@gmail.com> wrote:\n>> 2008/10/3 Constantine Plotnikov <constantine.plotnikov@gmail.com>:\n>> > Is there a way to force a progress output on stderr for git clone\n>> > preferably using options or environment variables?\n>>\n>> No, but \"-v\" option is not used for anything yet, so you are free to\n>> implement it.\n>\n> Something like this?\n>\n\nYes. Does it work? :)\n"},{"id":"92563","messageId":"20081007193956.GB536@genesis.frugalware.org","threadId":"15777","inReplyTo":"81b0412b0810062321h33abe076kd87b60bffdaf218b@mail.gmail.com","subject":"Re: [PATCH] Implement git clone -v","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-10-07T19:39:56Z","receivedAt":"2008-10-07T19:39:56Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Tue, Oct 07, 2008 at 08:21:28AM +0200, Alex Riesen <raa.lkml@gmail.com> wrote:\n> Yes. Does it work? :)\n\nYes, it does. I'm not sure how to test it from the testsuite, maybe\nredirect the output to a file and grep in it? It's ugly, that's why I\ndid not do so, but if you think a testcase is a musthave for this\nfeature then that's the way to go, I guess.\n"},{"id":"92579","messageId":"20081008060257.GA15240@spearce.org","threadId":"15777","inReplyTo":"20081007193956.GB536@genesis.frugalware.org","subject":"Re: [PATCH] Implement git clone -v","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-08T06:02:57Z","receivedAt":"2008-10-08T06:02:57Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Miklos Vajna <vmiklos@frugalware.org> wrote:\n> On Tue, Oct 07, 2008 at 08:21:28AM +0200, Alex Riesen <raa.lkml@gmail.com> wrote:\n> > Yes. Does it work? :)\n> \n> Yes, it does. I'm not sure how to test it from the testsuite, maybe\n> redirect the output to a file and grep in it? It's ugly, that's why I\n> did not do so, but if you think a testcase is a musthave for this\n> feature then that's the way to go, I guess.\n\nActually its not a bad way to test the feature.  Normally we disable\nprogress if stdout is not a tty.  If you redirect to a file then\n-v should be needed to get anything at all on stderr.\n\nYou may be able to just test the size of the file:\n\n\tgit fetch -v ... >out 2>err &&\n\ttest -s err\n\n-- \nShawn.\n"},{"id":"92651","messageId":"20081008062529.GA4028@blimp.localhost","threadId":"15777","inReplyTo":"20081008060257.GA15240@spearce.org","subject":"Re: [PATCH] Implement git clone -v","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-10-08T06:25:29Z","receivedAt":"2008-10-08T06:25:29Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Shawn O. Pearce, Wed, Oct 08, 2008 08:02:57 +0200:\n> Miklos Vajna <vmiklos@frugalware.org> wrote:\n> > On Tue, Oct 07, 2008 at 08:21:28AM +0200, Alex Riesen <raa.lkml@gmail.com> wrote:\n> > > Yes. Does it work? :)\n> > \n> > Yes, it does. I'm not sure how to test it from the testsuite, maybe\n> > redirect the output to a file and grep in it? It's ugly, that's why I\n> > did not do so, but if you think a testcase is a musthave for this\n> > feature then that's the way to go, I guess.\n> \n> Actually its not a bad way to test the feature.  Normally we disable\n> progress if stdout is not a tty.  If you redirect to a file then\n> -v should be needed to get anything at all on stderr.\n> \n> You may be able to just test the size of the file:\n> \n> \tgit fetch -v ... >out 2>err &&\n\ngit clone\n\n> \ttest -s err\n\nRight, but I don't think you need tests for progress bar. As a typical\neye candy, it tends to change often enough to be too annoying to test.\n"},{"id":"92631","messageId":"1223509232-3520-1-git-send-email-vmiklos@frugalware.org","threadId":"15777","inReplyTo":"20081008060257.GA15240@spearce.org","subject":"[PATCH] Implement git clone -v","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-10-08T23:40:32Z","receivedAt":"2008-10-08T23:40:32Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"The new -v option forces the progressbar, even in case the output is not\na terminal.\n\nSigned-off-by: Miklos Vajna <vmiklos@frugalware.org>\n---\n\nOn Tue, Oct 07, 2008 at 11:02:57PM -0700, \"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> You may be able to just test the size of the file:\n>\n>       git fetch -v ... >out 2>err &&\n>       test -s err\n\nHere is an updated patch, now with testcases.\n\n Documentation/git-clone.txt |    5 +++++\n builtin-clone.c             |    4 ++++\n t/t5702-clone-options.sh    |   13 +++++++++++++\n transport.c                 |    2 +-\n transport.h                 |    2 ++\n 5 files changed, 25 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex 0e14e73..95f08b9 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -90,6 +90,11 @@ then the cloned repository will become corrupt.\n \tOperate quietly.  This flag is also passed to the `rsync'\n \tcommand when given.\n \n+--verbose::\n+-v::\n+\tDisplay the progressbar, even in case the standard output is not\n+\ta terminal.\n+\n --no-checkout::\n -n::\n \tNo checkout of HEAD is performed after the clone is complete.\ndiff --git a/builtin-clone.c b/builtin-clone.c\nindex 49d2eb9..df71b23 100644\n--- a/builtin-clone.c\n+++ b/builtin-clone.c\n@@ -38,9 +38,11 @@ static int option_local, option_no_hardlinks, option_shared;\n static char *option_template, *option_reference, *option_depth;\n static char *option_origin = NULL;\n static char *option_upload_pack = \"git-upload-pack\";\n+static int option_verbose;\n \n static struct option builtin_clone_options[] = {\n \tOPT__QUIET(&option_quiet),\n+\tOPT__VERBOSE(&option_verbose),\n \tOPT_BOOLEAN('n', \"no-checkout\", &option_no_checkout,\n \t\t    \"don't create a checkout\"),\n \tOPT_BOOLEAN(0, \"bare\", &option_bare, \"create a bare repository\"),\n@@ -506,6 +508,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \n \t\tif (option_quiet)\n \t\t\ttransport->verbose = -1;\n+\t\telse if (option_verbose)\n+\t\t\ttransport->progress = 1;\n \n \t\tif (option_upload_pack)\n \t\t\ttransport_set_option(transport, TRANS_OPT_UPLOADPACK,\ndiff --git a/t/t5702-clone-options.sh b/t/t5702-clone-options.sh\nindex 328e4d9..27825f5 100755\n--- a/t/t5702-clone-options.sh\n+++ b/t/t5702-clone-options.sh\n@@ -19,4 +19,17 @@ test_expect_success 'clone -o' '\n \n '\n \n+test_expect_success 'redirected clone' '\n+\n+\tgit clone \"file://$(pwd)/parent\" clone-redirected >out 2>err &&\n+\ttest ! -s err\n+\n+'\n+test_expect_success 'redirected clone -v' '\n+\n+\tgit clone -v \"file://$(pwd)/parent\" clone-redirected-v >out 2>err &&\n+\ttest -s err\n+\n+'\n+\n test_done\ndiff --git a/transport.c b/transport.c\nindex 5110c56..1c510a3 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -644,7 +644,7 @@ static int fetch_refs_via_pack(struct transport *transport,\n \targs.include_tag = data->followtags;\n \targs.verbose = (transport->verbose > 0);\n \targs.quiet = (transport->verbose < 0);\n-\targs.no_progress = args.quiet || !isatty(1);\n+\targs.no_progress = args.quiet || (!transport->progress && !isatty(1));\n \targs.depth = data->depth;\n \n \tfor (i = 0; i < nr_heads; i++)\ndiff --git a/transport.h b/transport.h\nindex d0b5205..6bbc1a8 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -25,6 +25,8 @@ struct transport {\n \tint (*disconnect)(struct transport *connection);\n \tchar *pack_lockfile;\n \tsigned verbose : 2;\n+\t/* Force progress even if the output is not a tty */\n+\tunsigned progress : 1;\n };\n \n #define TRANSPORT_PUSH_ALL 1\n-- \n1.6.0.2\n"},{"id":"92660","messageId":"7vr66qown3.fsf@gitster.siamese.dyndns.org","threadId":"15777","inReplyTo":"1223509232-3520-1-git-send-email-vmiklos@frugalware.org","subject":"Re: [PATCH] Implement git clone -v","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-10-09T11:06:40Z","receivedAt":"2008-10-09T11:06:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Miklos Vajna <vmiklos@frugalware.org> writes:\n\n> The new -v option forces the progressbar, even in case the output is not\n> a terminal.\n>\n> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>\n\nThe patch made me wonder why this new feature had to be implemented in the\nfirst place and had me look up the message the patch was an follow-up to.\nFor somebody who would not recall the original request-for-feature (that\nincludes you 6 months from now), it would have been easier to understand\nthe context if the commit message said what the intended purpose of this\n(i.e. \"have it read by an IDE\").\n"},{"id":"92680","messageId":"20081009152028.GA29829@spearce.org","threadId":"15777","inReplyTo":"7vr66qown3.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Implement git clone -v","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-09T15:20:28Z","receivedAt":"2008-10-09T15:20:28Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Miklos Vajna <vmiklos@frugalware.org> writes:\n> \n> > The new -v option forces the progressbar, even in case the output is not\n> > a terminal.\n> >\n> > Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>\n> \n> The patch made me wonder why this new feature had to be implemented in the\n> first place and had me look up the message the patch was an follow-up to.\n> For somebody who would not recall the original request-for-feature (that\n> includes you 6 months from now), it would have been easier to understand\n> the context if the commit message said what the intended purpose of this\n> (i.e. \"have it read by an IDE\").\n\nI'm amending the message as the following:\n\n--8<--\nImplement git clone -v\n\nThe new -v option forces the progressbar, even in case the output\nis not a terminal.  This can be useful if the caller is an IDE or\nwrapper which wants to scrape the progressbar from stderr and show\nits information in a different format.\n\nSigned-off-by: Miklos Vajna <vmiklos@frugalware.org>\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n--\n\n-- \nShawn.\n"},{"id":"92705","messageId":"20081009212644.GX536@genesis.frugalware.org","threadId":"15777","inReplyTo":"20081009152028.GA29829@spearce.org","subject":"Re: [PATCH] Implement git clone -v","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-10-09T21:26:44Z","receivedAt":"2008-10-09T21:26:44Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Thu, Oct 09, 2008 at 08:20:28AM -0700, \"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> I'm amending the message as the following:\n> \n> --8<--\n> Implement git clone -v\n> \n> The new -v option forces the progressbar, even in case the output\n> is not a terminal.  This can be useful if the caller is an IDE or\n> wrapper which wants to scrape the progressbar from stderr and show\n> its information in a different format.\n\nThanks!\n"}]}