* Making git push output quieter @ 2009-08-04 21:27 Albert Astals Cid 2009-08-04 22:20 ` Pau Garcia i Quiles 0 siblings, 1 reply; 19+ messages in thread From: Albert Astals Cid @ 2009-08-04 21:27 UTC (permalink / raw) To: git Hi, at KDE we are starting to try to use git and one of the things that's bothering me is that git push is too verbose for our scripts. We have some scripts that commit things and i get the diff of previous runs, if there is no diff it means all worked fine, a diff means something i have to look at. Now i'm getting diffs like -Counting objects: 23, done. +Counting objects: 53, done. Delta compression using up to 2 threads. -Compressing objects: 8% (1/12) Compressing objects: 16% (2/12) Compressing objects: 25% (3/12) Compressing objects: 33% (4/12) Compressing objects: 41% (5/12) Compressing objects: 50% (6/12) Compressing objects: 58% (7/12) Compressing objects: 66% (8/12) Compressing objects: 75% (9/12) Compressing objects: 83% (10/12) Compressing objects: 91% (11/12) Compressing objects: 100% (12/12) Compressing objects: 100% (12/12), done. -Writing objects: 8% (1/12) Writing objects: 16% (2/12) Writing objects: 25% (3/12) Writing objects: 33% (4/12) Writing objects: 41% (5/12) Writing objects: 50% (6/12) Writing objects: 58% (7/12) Writing objects: 66% (8/12) Writing objects: 75% (9/12) Writing objects: 83% (10/12) Writing objects: 91% (11/12) Writing objects: 100% (12/12) Writing objects: 100% (12/12), 1.05 KiB, done. -Total 12 (delta 11), reused 0 (delta 0) +Compressing objects: 3% (1/29) Compressing objects: 6% (2/29) Compressing objects: 10% (3/29) Compressing objects: 13% (4/29) Compressing objects: 17% (5/29) Compressing objects: 20% (6/29) Compressing objects: 24% (7/29) Compressing objects: 27% (8/29) Compressing objects: 31% (9/29) Compressing objects: 34% (10/29) Compressing objects: 37% (11/29) Compressing objects: 41% (12/29) Compressing objects: 44% (13/29) Compressing objects: 48% (14/29) Compressing objects: 51% (15/29) Compressing objects: 55% (16/29) Compressing objects: 58% (17/29) Compressing objects: 62% (18/29) Compressing objects: 65% (19/29) Compressing objects: 68% (20/29) Compressing objects: 72% (21/29) Compressing objects: 75% (22/29) Compressing objects: 79% (23/29) Compressing objects: 82% (24/29) Compressing objects: 86% (25/29) Compressing objects: 89% (26/29) Compressing objects: 93% (27/29) Compressing objects: 96% (28/29) Compressing objects: 100% (29/29) Compressing objects: 100% (29/29), done. +Writing objects: 3% (1/29) Writing objects: 6% (2/29) Writing objects: 10% (3/29) Writing objects: 13% (4/29) Writing objects: 17% (5/29) Writing objects: 20% (6/29) Writing objects: 24% (7/29) Writing objects: 27% (8/29) Writing objects: 31% (9/29) Writing objects: 34% (10/29) Writing objects: 37% (11/29) Writing objects: 41% (12/29) Writing objects: 44% (13/29) Writing objects: 48% (14/29) Writing objects: 51% (15/29) Writing objects: 55% (16/29) Writing objects: 62% (18/29) Writing objects: 65% (19/29) Writing objects: 68% (20/29) Writing objects: 72% (21/29) Writing objects: 75% (22/29) Writing objects: 79% (23/29) Writing objects: 82% (24/29) Writing objects: 86% (25/29) Writing objects: 89% (26/29) Writing objects: 93% (27/29) Writing objects: 96% (28/29) Writing objects: 100% (29/29) Writing objects: 100% (29/29), 4.46 KiB, done. +Total 29 (delta 23), reused 0 (delta 0) => Syncing Gitorious... [OK] To git@gitorious.org:amarok/amarok.git - f7863f9..f4370ae HEAD -> master + 1a1b30f..670cb0e HEAD -> master That really are not a problem and are filling my diffs for no reason. We could redirect to > /dev/null the git push command but then i would not see if anything failed. Is it possible to make git push just output data when failing? And if not do you think it's a worthwhile feature i can ask for? Do you have a formal way for feature requests? Thanks, Albert ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Making git push output quieter 2009-08-04 21:27 Making git push output quieter Albert Astals Cid @ 2009-08-04 22:20 ` Pau Garcia i Quiles 2009-08-05 19:13 ` Albert Astals Cid 0 siblings, 1 reply; 19+ messages in thread From: Pau Garcia i Quiles @ 2009-08-04 22:20 UTC (permalink / raw) To: Albert Astals Cid; +Cc: git On Tue, Aug 4, 2009 at 11:27 PM, Albert Astals Cid<aacid@kde.org> wrote: > Hi, at KDE we are starting to try to use git and one of the things that's > bothering me is that git push is too verbose for our scripts. > > We have some scripts that commit things and i get the diff of previous runs, > if there is no diff it means all worked fine, a diff means something i have to > look at. > > Now i'm getting diffs like > > -Counting objects: 23, done. > +Counting objects: 53, done. > Delta compression using up to 2 threads. > -Compressing objects: 8% (1/12) Compressing objects: 16% (2/12) > Compressing objects: 25% (3/12) Compressing objects: 33% (4/12) > Compressing objects: 41% (5/12) Compressing objects: 50% (6/12) > Compressing objects: 58% (7/12) Compressing objects: 66% (8/12) > Compressing objects: 75% (9/12) Compressing objects: 83% (10/12) > Compressing objects: 91% (11/12) Compressing objects: 100% (12/12) > Compressing objects: 100% (12/12), done. > -Writing objects: 8% (1/12) Writing objects: 16% (2/12) Writing > objects: 25% (3/12) Writing objects: 33% (4/12) Writing objects: 41% > (5/12) Writing objects: 50% (6/12) Writing objects: 58% (7/12) Writing > objects: 66% (8/12) Writing objects: 75% (9/12) Writing objects: 83% > (10/12) Writing objects: 91% (11/12) Writing objects: 100% (12/12) > Writing objects: 100% (12/12), 1.05 KiB, done. > -Total 12 (delta 11), reused 0 (delta 0) > +Compressing objects: 3% (1/29) Compressing objects: 6% (2/29) > Compressing objects: 10% (3/29) Compressing objects: 13% (4/29) > Compressing objects: 17% (5/29) Compressing objects: 20% (6/29) > Compressing objects: 24% (7/29) Compressing objects: 27% (8/29) > Compressing objects: 31% (9/29) Compressing objects: 34% (10/29) > Compressing objects: 37% (11/29) Compressing objects: 41% (12/29) > Compressing objects: 44% (13/29) Compressing objects: 48% (14/29) > Compressing objects: 51% (15/29) Compressing objects: 55% (16/29) > Compressing objects: 58% (17/29) Compressing objects: 62% (18/29) > Compressing objects: 65% (19/29) Compressing objects: 68% (20/29) > Compressing objects: 72% (21/29) Compressing objects: 75% (22/29) > Compressing objects: 79% (23/29) Compressing objects: 82% (24/29) > Compressing objects: 86% (25/29) Compressing objects: 89% (26/29) > Compressing objects: 93% (27/29) Compressing objects: 96% (28/29) > Compressing objects: 100% (29/29) Compressing objects: 100% (29/29), done. > +Writing objects: 3% (1/29) Writing objects: 6% (2/29) Writing > objects: 10% (3/29) Writing objects: 13% (4/29) Writing objects: 17% > (5/29) Writing objects: 20% (6/29) Writing objects: 24% (7/29) Writing > objects: 27% (8/29) Writing objects: 31% (9/29) Writing objects: 34% > (10/29) Writing objects: 37% (11/29) Writing objects: 41% (12/29) > Writing objects: 44% (13/29) Writing objects: 48% (14/29) Writing > objects: 51% (15/29) Writing objects: 55% (16/29) Writing objects: 62% > (18/29) Writing objects: 65% (19/29) Writing objects: 68% (20/29) > Writing objects: 72% (21/29) Writing objects: 75% (22/29) Writing > objects: 79% (23/29) Writing objects: 82% (24/29) Writing objects: 86% > (25/29) Writing objects: 89% (26/29) Writing objects: 93% (27/29) > Writing objects: 96% (28/29) Writing objects: 100% (29/29) Writing > objects: 100% (29/29), 4.46 KiB, done. > +Total 29 (delta 23), reused 0 (delta 0) > => Syncing Gitorious... [OK] > To git@gitorious.org:amarok/amarok.git > - f7863f9..f4370ae HEAD -> master > + 1a1b30f..670cb0e HEAD -> master > > That really are not a problem and are filling my diffs for no reason. We could > redirect to > /dev/null the git push command but then i would not see if > anything failed. > > Is it possible to make git push just output data when failing? And if not do > you think it's a worthwhile feature i can ask for? Do you have a formal way > for feature requests? Have you tried redirecting only stdout to /dev/null, and keeping stderr to yourself ? In addition to that, exit code != 0 means something went wrong. -- Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer) ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Making git push output quieter 2009-08-04 22:20 ` Pau Garcia i Quiles @ 2009-08-05 19:13 ` Albert Astals Cid 2009-08-05 19:26 ` Shawn O. Pearce 0 siblings, 1 reply; 19+ messages in thread From: Albert Astals Cid @ 2009-08-05 19:13 UTC (permalink / raw) To: Pau Garcia i Quiles; +Cc: git A Dimecres, 5 d'agost de 2009, Pau Garcia i Quiles va escriure: > On Tue, Aug 4, 2009 at 11:27 PM, Albert Astals Cid<aacid@kde.org> wrote: > > Hi, at KDE we are starting to try to use git and one of the things that's > > bothering me is that git push is too verbose for our scripts. > > > > We have some scripts that commit things and i get the diff of previous > > runs, if there is no diff it means all worked fine, a diff means > > something i have to look at. > > > > Now i'm getting diffs like > > > > -Counting objects: 23, done. > > +Counting objects: 53, done. > > Delta compression using up to 2 threads. > > -Compressing objects: 8% (1/12) Compressing objects: 16% (2/12) > > Compressing objects: 25% (3/12) Compressing objects: 33% (4/12) > > Compressing objects: 41% (5/12) Compressing objects: 50% (6/12) > > Compressing objects: 58% (7/12) Compressing objects: 66% (8/12) > > Compressing objects: 75% (9/12) Compressing objects: 83% (10/12) > > Compressing objects: 91% (11/12) Compressing objects: 100% (12/12) > > Compressing objects: 100% (12/12), done. > > -Writing objects: 8% (1/12) Writing objects: 16% (2/12) Writing > > objects: 25% (3/12) Writing objects: 33% (4/12) Writing objects: > > 41% (5/12) Writing objects: 50% (6/12) Writing objects: 58% (7/12) > > Writing objects: 66% (8/12) Writing objects: 75% (9/12) Writing > > objects: 83% (10/12) Writing objects: 91% (11/12) Writing objects: > > 100% (12/12) Writing objects: 100% (12/12), 1.05 KiB, done. > > -Total 12 (delta 11), reused 0 (delta 0) > > +Compressing objects: 3% (1/29) Compressing objects: 6% (2/29) > > Compressing objects: 10% (3/29) Compressing objects: 13% (4/29) > > Compressing objects: 17% (5/29) Compressing objects: 20% (6/29) > > Compressing objects: 24% (7/29) Compressing objects: 27% (8/29) > > Compressing objects: 31% (9/29) Compressing objects: 34% (10/29) > > Compressing objects: 37% (11/29) Compressing objects: 41% (12/29) > > Compressing objects: 44% (13/29) Compressing objects: 48% (14/29) > > Compressing objects: 51% (15/29) Compressing objects: 55% (16/29) > > Compressing objects: 58% (17/29) Compressing objects: 62% (18/29) > > Compressing objects: 65% (19/29) Compressing objects: 68% (20/29) > > Compressing objects: 72% (21/29) Compressing objects: 75% (22/29) > > Compressing objects: 79% (23/29) Compressing objects: 82% (24/29) > > Compressing objects: 86% (25/29) Compressing objects: 89% (26/29) > > Compressing objects: 93% (27/29) Compressing objects: 96% (28/29) > > Compressing objects: 100% (29/29) Compressing objects: 100% (29/29), > > done. +Writing objects: 3% (1/29) Writing objects: 6% (2/29) > > Writing objects: 10% (3/29) Writing objects: 13% (4/29) Writing > > objects: 17% (5/29) Writing objects: 20% (6/29) Writing objects: > > 24% (7/29) Writing objects: 27% (8/29) Writing objects: 31% (9/29) > > Writing objects: 34% (10/29) Writing objects: 37% (11/29) Writing > > objects: 41% (12/29) Writing objects: 44% (13/29) Writing objects: > > 48% (14/29) Writing objects: 51% (15/29) Writing objects: 55% > > (16/29) Writing objects: 62% (18/29) Writing objects: 65% (19/29) > > Writing objects: 68% (20/29) Writing objects: 72% (21/29) Writing > > objects: 75% (22/29) Writing objects: 79% (23/29) Writing objects: > > 82% (24/29) Writing objects: 86% (25/29) Writing objects: 89% > > (26/29) Writing objects: 93% (27/29) Writing objects: 96% (28/29) > > Writing objects: 100% (29/29) Writing objects: 100% (29/29), 4.46 KiB, > > done. > > +Total 29 (delta 23), reused 0 (delta 0) > > => Syncing Gitorious... [OK] > > To git@gitorious.org:amarok/amarok.git > > - f7863f9..f4370ae HEAD -> master > > + 1a1b30f..670cb0e HEAD -> master > > > > That really are not a problem and are filling my diffs for no reason. We > > could redirect to > /dev/null the git push command but then i would not > > see if anything failed. > > > > Is it possible to make git push just output data when failing? And if not > > do you think it's a worthwhile feature i can ask for? Do you have a > > formal way for feature requests? > > Have you tried redirecting only stdout to /dev/null, and keeping > stderr to yourself ? Everything goes to stderr. > In addition to that, exit code != 0 means > something went wrong. I could make something with this, but is it really not something that should happen that errors go to stderr and regular text to stdout? Albert ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Making git push output quieter 2009-08-05 19:13 ` Albert Astals Cid @ 2009-08-05 19:26 ` Shawn O. Pearce 2009-08-05 19:51 ` Nicolas Pitre 0 siblings, 1 reply; 19+ messages in thread From: Shawn O. Pearce @ 2009-08-05 19:26 UTC (permalink / raw) To: Albert Astals Cid, Junio C Hamano, Nicolas Pitre; +Cc: Pau Garcia i Quiles, git Albert Astals Cid <aacid@kde.org> wrote: > A Dimecres, 5 d'agost de 2009, Pau Garcia i Quiles va escriure: > > On Tue, Aug 4, 2009 at 11:27 PM, Albert Astals Cid<aacid@kde.org> wrote: > > > Hi, at KDE we are starting to try to use git and one of the things that's > > > bothering me is that git push is too verbose for our scripts. ... > > Have you tried redirecting only stdout to /dev/null, and keeping > > stderr to yourself ? > > Everything goes to stderr. Sadly our use of isatty to determine if progress/verbosity should be used is inconsistent. pack-objects.c, which is what you are talking about above, is using stderr to determine if progress should be enabled, but other code like transport.c, which is used on the client side, is using stdout. Hence the suggestion above to redirect stdout to /dev/null to try and shutoff the spew. $ git grep isatty builtin-commit.c: if (isatty(0)) builtin-config.c: stdout_is_tty = isatty(1); builtin-pack-objects.c: progress = isatty(2); builtin-revert.c: if (isatty(0)) builtin-shortlog.c: if (!nongit && !rev.pending.nr && isatty(0)) builtin-unpack-objects.c: quiet = !isatty(2); color.c: stdout_is_tty = isatty(1); compat/winansi.c: if (!isatty(fileno(stream))) compat/winansi.c: if (!isatty(fileno(stream))) pack-redundant.c: if (!isatty(0)) { pager.c: if (!isatty(1)) pager.c: if (isatty(2)) transport.c: args.no_progress = args.quiet || (!transport->progress && !isatty(1)); wt-status.c: * will have checked isatty on stdout). I'm thinking this might be a reasonable patch to apply, Junio/Nico? --8<-- pack-objects: Display progress only if stdout is tty Client transports underneath git fetch display progress output only if stdout is a tty, allowing redirection of stdout to /dev/null (or a pipe) to silence progress but still report actual errors on stderr. Doing the same in pack-objects means push, bundle creation and repack can use the same trick to silence noisy progress progress, but still obtain real errors. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- builtin-pack-objects.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 961b639..0b9234a 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -2110,7 +2110,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) if (!pack_compression_seen && core_compression_seen) pack_compression_level = core_compression_level; - progress = isatty(2); + progress = isatty(1); for (i = 1; i < argc; i++) { const char *arg = argv[i]; -- 1.6.4.70.g9c084 -- Shawn. ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: Making git push output quieter 2009-08-05 19:26 ` Shawn O. Pearce @ 2009-08-05 19:51 ` Nicolas Pitre 2009-08-05 20:19 ` Jeff King 0 siblings, 1 reply; 19+ messages in thread From: Nicolas Pitre @ 2009-08-05 19:51 UTC (permalink / raw) To: Shawn O. Pearce Cc: Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git On Wed, 5 Aug 2009, Shawn O. Pearce wrote: > Albert Astals Cid <aacid@kde.org> wrote: > > A Dimecres, 5 d'agost de 2009, Pau Garcia i Quiles va escriure: > > > On Tue, Aug 4, 2009 at 11:27 PM, Albert Astals Cid<aacid@kde.org> wrote: > > > > Hi, at KDE we are starting to try to use git and one of the things that's > > > > bothering me is that git push is too verbose for our scripts. > ... > > > Have you tried redirecting only stdout to /dev/null, and keeping > > > stderr to yourself ? > > > > Everything goes to stderr. > > Sadly our use of isatty to determine if progress/verbosity should > be used is inconsistent. pack-objects.c, which is what you are > talking about above, is using stderr to determine if progress should > be enabled, but other code like transport.c, which is used on the > client side, is using stdout. Hence the suggestion above to redirect > stdout to /dev/null to try and shutoff the spew. > > $ git grep isatty > builtin-commit.c: if (isatty(0)) > builtin-config.c: stdout_is_tty = isatty(1); > builtin-pack-objects.c: progress = isatty(2); > builtin-revert.c: if (isatty(0)) > builtin-shortlog.c: if (!nongit && !rev.pending.nr && isatty(0)) > builtin-unpack-objects.c: quiet = !isatty(2); > color.c: stdout_is_tty = isatty(1); > compat/winansi.c: if (!isatty(fileno(stream))) > compat/winansi.c: if (!isatty(fileno(stream))) > pack-redundant.c: if (!isatty(0)) { > pager.c: if (!isatty(1)) > pager.c: if (isatty(2)) > transport.c: args.no_progress = args.quiet || (!transport->progress && !isatty(1)); > wt-status.c: * will have checked isatty on stdout). > > I'm thinking this might be a reasonable patch to apply, Junio/Nico? > > --8<-- > pack-objects: Display progress only if stdout is tty > > Client transports underneath git fetch display progress output only > if stdout is a tty, allowing redirection of stdout to /dev/null (or > a pipe) to silence progress but still report actual errors on stderr. > > Doing the same in pack-objects means push, bundle creation and > repack can use the same trick to silence noisy progress progress, > but still obtain real errors. > > Signed-off-by: Shawn O. Pearce <spearce@spearce.org> > --- > builtin-pack-objects.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c > index 961b639..0b9234a 100644 > --- a/builtin-pack-objects.c > +++ b/builtin-pack-objects.c > @@ -2110,7 +2110,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) > if (!pack_compression_seen && core_compression_seen) > pack_compression_level = core_compression_level; > > - progress = isatty(2); > + progress = isatty(1); Doesn't this break progress reporting on a push since stdout is never a tty in that case? Same issue on a fetch although in that case the progress level is provided explicitly by the caller. > for (i = 1; i < argc; i++) { > const char *arg = argv[i]; > > -- > 1.6.4.70.g9c084 > > > -- > Shawn. > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Making git push output quieter 2009-08-05 19:51 ` Nicolas Pitre @ 2009-08-05 20:19 ` Jeff King 2009-08-05 20:22 ` [RFC/PATCH 1/3] push: add --quiet flag Jeff King ` (2 more replies) 0 siblings, 3 replies; 19+ messages in thread From: Jeff King @ 2009-08-05 20:19 UTC (permalink / raw) To: Nicolas Pitre Cc: Shawn O. Pearce, Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git On Wed, Aug 05, 2009 at 03:51:27PM -0400, Nicolas Pitre wrote: > > - progress = isatty(2); > > + progress = isatty(1); > > Doesn't this break progress reporting on a push since stdout is never a > tty in that case? Same issue on a fetch although in that case the > progress level is provided explicitly by the caller. It also doesn't entirely fix the original poster's problem. There are actually two outputs: the progress report and the push status. I think we actually just want a "--quiet" flag here which is passed along to pack-objects, and which suppresses the push status. Patch series to follow: 1/3: push: add --quiet flag 2/3: transport: pass "quiet" flag to pack-objects 3/3: transport: don't show push status if --quiet is given -Peff ^ permalink raw reply [flat|nested] 19+ messages in thread
* [RFC/PATCH 1/3] push: add --quiet flag 2009-08-05 20:19 ` Jeff King @ 2009-08-05 20:22 ` Jeff King 2009-08-05 20:22 ` [PATCH 2/3] transport: pass "quiet" flag to pack-objects Jeff King 2009-08-05 20:23 ` [PATCH 3/3] transport: don't show push status if --quiet is given Jeff King 2 siblings, 0 replies; 19+ messages in thread From: Jeff King @ 2009-08-05 20:22 UTC (permalink / raw) To: Nicolas Pitre Cc: Shawn O. Pearce, Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git Some transports produce output even without "--verbose" turned on. This provides a way to tell them to be more quiet (whereas simply redirecting might lose error messages). Signed-off-by: Jeff King <peff@peff.net> --- Missing tests and docs still. It may be a bit weird, but you can actually say "--quiet --verbose" and they don't exactly cancel each other. But it can actually be useful to say "don't show me the ref status unless there is an error (--quiet), in which case show me the entire table (--verbose)". builtin-push.c | 1 + transport.h | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/builtin-push.c b/builtin-push.c index 1d92e22..bc0c91a 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -168,6 +168,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) const char *repo = NULL; /* default repository */ struct option options[] = { + OPT_BIT('q', "quiet", &flags, "be quiet", TRANSPORT_PUSH_QUIET), OPT_BIT('v', "verbose", &flags, "be verbose", TRANSPORT_PUSH_VERBOSE), OPT_STRING( 0 , "repo", &repo, "repository", "repository"), OPT_BIT( 0 , "all", &flags, "push all refs", TRANSPORT_PUSH_ALL), diff --git a/transport.h b/transport.h index 51b5397..f1d3ebf 100644 --- a/transport.h +++ b/transport.h @@ -36,6 +36,7 @@ struct transport { #define TRANSPORT_PUSH_MIRROR 8 #define TRANSPORT_PUSH_VERBOSE 16 #define TRANSPORT_PUSH_PORCELAIN 32 +#define TRANSPORT_PUSH_QUIET 64 /* Returns a transport suitable for the url */ struct transport *transport_get(struct remote *, const char *); -- 1.6.4.218.g9f65c.dirty ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/3] transport: pass "quiet" flag to pack-objects 2009-08-05 20:19 ` Jeff King 2009-08-05 20:22 ` [RFC/PATCH 1/3] push: add --quiet flag Jeff King @ 2009-08-05 20:22 ` Jeff King 2009-08-05 20:23 ` [PATCH 3/3] transport: don't show push status if --quiet is given Jeff King 2 siblings, 0 replies; 19+ messages in thread From: Jeff King @ 2009-08-05 20:22 UTC (permalink / raw) To: Nicolas Pitre Cc: Shawn O. Pearce, Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git When pushing over the git protocol, pack-objects gives progress reports about the pack being sent. If "push" is given the --quiet flag, it now passes "-q" to pack-objects, suppressing this output. Signed-off-by: Jeff King <peff@peff.net> --- builtin-send-pack.c | 3 +++ send-pack.h | 1 + transport.c | 1 + 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/builtin-send-pack.c b/builtin-send-pack.c index 47fb9f7..37e528e 100644 --- a/builtin-send-pack.c +++ b/builtin-send-pack.c @@ -44,6 +44,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext NULL, NULL, NULL, + NULL, }; struct child_process po; int i; @@ -53,6 +54,8 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext argv[i++] = "--thin"; if (args->use_ofs_delta) argv[i++] = "--delta-base-offset"; + if (args->quiet) + argv[i++] = "-q"; memset(&po, 0, sizeof(po)); po.argv = argv; po.in = -1; diff --git a/send-pack.h b/send-pack.h index 1d7b1b3..8b3cf02 100644 --- a/send-pack.h +++ b/send-pack.h @@ -3,6 +3,7 @@ struct send_pack_args { unsigned verbose:1, + quiet:1, send_mirror:1, force_update:1, use_thin_pack:1, diff --git a/transport.c b/transport.c index 8a42e76..2d0c491 100644 --- a/transport.c +++ b/transport.c @@ -878,6 +878,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re args.force_update = !!(flags & TRANSPORT_PUSH_FORCE); args.use_thin_pack = data->thin; args.verbose = !!(flags & TRANSPORT_PUSH_VERBOSE); + args.quiet = !!(flags & TRANSPORT_PUSH_QUIET); args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN); ret = send_pack(&args, data->fd, data->conn, remote_refs, -- 1.6.4.218.g9f65c.dirty ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 20:19 ` Jeff King 2009-08-05 20:22 ` [RFC/PATCH 1/3] push: add --quiet flag Jeff King 2009-08-05 20:22 ` [PATCH 2/3] transport: pass "quiet" flag to pack-objects Jeff King @ 2009-08-05 20:23 ` Jeff King 2009-08-05 20:27 ` Sverre Rabbelier 2009-08-05 20:39 ` Junio C Hamano 2 siblings, 2 replies; 19+ messages in thread From: Jeff King @ 2009-08-05 20:23 UTC (permalink / raw) To: Nicolas Pitre Cc: Shawn O. Pearce, Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git When --quiet is given, the user generally only wants to see errors. So let's suppress printing the ref status table unless there is an error, in which case we print out the whole table. Signed-off-by: Jeff King <peff@peff.net> --- We could get fancier here and print out only the refs with errors if quiet is given, but I went for simplicity. transport.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/transport.c b/transport.c index 2d0c491..afec5b7 100644 --- a/transport.c +++ b/transport.c @@ -667,6 +667,21 @@ static int fetch_refs_via_pack(struct transport *transport, return (refs ? 0 : -1); } +static int push_had_errors(struct ref *ref) +{ + for (; ref; ref = ref->next) { + switch (ref->status) { + case REF_STATUS_NONE: + case REF_STATUS_UPTODATE: + case REF_STATUS_OK: + break; + default: + return 1; + } + } + return 0; +} + static int refs_pushed(struct ref *ref) { for (; ref; ref = ref->next) { @@ -996,6 +1011,7 @@ int transport_push(struct transport *transport, struct ref *local_refs = get_local_heads(); int match_flags = MATCH_REFS_NONE; int verbose = flags & TRANSPORT_PUSH_VERBOSE; + int quiet = flags & TRANSPORT_PUSH_QUIET; int porcelain = flags & TRANSPORT_PUSH_PORCELAIN; int ret; @@ -1011,7 +1027,9 @@ int transport_push(struct transport *transport, ret = transport->push_refs(transport, remote_refs, flags); - print_push_status(transport->url, remote_refs, verbose | porcelain, porcelain); + if (!quiet || push_had_errors(remote_refs)) + print_push_status(transport->url, remote_refs, + verbose | porcelain, porcelain); if (!(flags & TRANSPORT_PUSH_DRY_RUN)) { struct ref *ref; -- 1.6.4.218.g9f65c.dirty ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 20:23 ` [PATCH 3/3] transport: don't show push status if --quiet is given Jeff King @ 2009-08-05 20:27 ` Sverre Rabbelier 2009-08-05 20:29 ` Avery Pennarun 2009-08-05 20:39 ` Junio C Hamano 1 sibling, 1 reply; 19+ messages in thread From: Sverre Rabbelier @ 2009-08-05 20:27 UTC (permalink / raw) To: Jeff King Cc: Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git Heya, On Wed, Aug 5, 2009 at 13:23, Jeff King<peff@peff.net> wrote: > + for (; ref; ref = ref->next) { > + switch (ref->status) { > + case REF_STATUS_NONE: > + case REF_STATUS_UPTODATE: > + case REF_STATUS_OK: > + break; > + default: > + return 1; > + } > + } Is my C getting sloppy or is this a non-looping loop? AFAICS it either return 1's on the first run, or breaks? -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 20:27 ` Sverre Rabbelier @ 2009-08-05 20:29 ` Avery Pennarun 2009-08-05 20:30 ` Sverre Rabbelier 0 siblings, 1 reply; 19+ messages in thread From: Avery Pennarun @ 2009-08-05 20:29 UTC (permalink / raw) To: Sverre Rabbelier Cc: Jeff King, Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git On Wed, Aug 5, 2009 at 8:27 PM, Sverre Rabbelier<srabbelier@gmail.com> wrote: > On Wed, Aug 5, 2009 at 13:23, Jeff King<peff@peff.net> wrote: >> + for (; ref; ref = ref->next) { >> + switch (ref->status) { >> + case REF_STATUS_NONE: >> + case REF_STATUS_UPTODATE: >> + case REF_STATUS_OK: >> + break; >> + default: >> + return 1; >> + } >> + } > > Is my C getting sloppy or is this a non-looping loop? AFAICS it either > return 1's on the first run, or breaks? The "break" in this case breaks out of the switch, not the for. Avery ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 20:29 ` Avery Pennarun @ 2009-08-05 20:30 ` Sverre Rabbelier 0 siblings, 0 replies; 19+ messages in thread From: Sverre Rabbelier @ 2009-08-05 20:30 UTC (permalink / raw) To: Avery Pennarun Cc: Jeff King, Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Junio C Hamano, Pau Garcia i Quiles, git Heya, On Wed, Aug 5, 2009 at 13:29, Avery Pennarun<apenwarr@gmail.com> wrote: >> Is my C getting sloppy or is this a non-looping loop? AFAICS it either >> return 1's on the first run, or breaks? > > The "break" in this case breaks out of the switch, not the for. Ouch, painfull, my C _IS_ getting sloppy :(. -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 20:23 ` [PATCH 3/3] transport: don't show push status if --quiet is given Jeff King 2009-08-05 20:27 ` Sverre Rabbelier @ 2009-08-05 20:39 ` Junio C Hamano 2009-08-05 20:48 ` Jeff King 1 sibling, 1 reply; 19+ messages in thread From: Junio C Hamano @ 2009-08-05 20:39 UTC (permalink / raw) To: Jeff King Cc: Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Pau Garcia i Quiles, git Jeff King <peff@peff.net> writes: > When --quiet is given, the user generally only wants to see > errors. That does not match what my cron job at day job expects. I'd welcome the warm and fuzzy feeling of seeing "ah, yes, we had changes on those branches to push out last night". Maybe it is just me, but my gut feeling is that it would be more appropriate to squelch only "already up to date" refs at least, at the default level of quietness. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 20:39 ` Junio C Hamano @ 2009-08-05 20:48 ` Jeff King 2009-08-05 21:01 ` Junio C Hamano 0 siblings, 1 reply; 19+ messages in thread From: Jeff King @ 2009-08-05 20:48 UTC (permalink / raw) To: Junio C Hamano Cc: Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Pau Garcia i Quiles, git On Wed, Aug 05, 2009 at 01:39:31PM -0700, Junio C Hamano wrote: > > When --quiet is given, the user generally only wants to see > > errors. > > That does not match what my cron job at day job expects. > > I'd welcome the warm and fuzzy feeling of seeing "ah, yes, we had changes > on those branches to push out last night". > > Maybe it is just me, but my gut feeling is that it would be more > appropriate to squelch only "already up to date" refs at least, at the > default level of quietness. I don't understand. Isn't that what "git push" _already_ does? Or are you saying you would like the "squelch progress" feature of 2/3, but not the "squelch ref status" of 3/3? In that case, are you not already doing something to squelch the progress? We could accomodate that by doubling --quiet to suppress ref status, though the transport interface seems to rely on flags (I guess we could have QUIET and REALLY_QUIET). -Peff ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 20:48 ` Jeff King @ 2009-08-05 21:01 ` Junio C Hamano 2009-08-05 21:17 ` Jeff King 0 siblings, 1 reply; 19+ messages in thread From: Junio C Hamano @ 2009-08-05 21:01 UTC (permalink / raw) To: Jeff King Cc: Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Pau Garcia i Quiles, git Jeff King <peff@peff.net> writes: > I don't understand. Isn't that what "git push" _already_ does? Sorry, it has been a while since I looked at print_push_status() the last time. You are right; without --verbose, we show interesting ref update status, excluding the "already up to date" report. What I meant was that I'd still want to see the non-verbose part of print_push_status(), while suppressing the progress report. That would make mails coming from the cron job much more pleasant to read. If you somehow can automatically squelch progress without -q for an unattended invocation (e.g. cron jobs), then I wouldn't need to pass -q and everything will be good. But if I have to pass -q in order to squelch progress, I do not want that same -q to automatically also mean "no status output", which is what your 3/3 is about, if I am reading the patch correctly. That's all. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 21:01 ` Junio C Hamano @ 2009-08-05 21:17 ` Jeff King 2009-08-31 18:33 ` Sebastian Pipping 0 siblings, 1 reply; 19+ messages in thread From: Jeff King @ 2009-08-05 21:17 UTC (permalink / raw) To: Junio C Hamano Cc: Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Pau Garcia i Quiles, git On Wed, Aug 05, 2009 at 02:01:44PM -0700, Junio C Hamano wrote: > What I meant was that I'd still want to see the non-verbose part of > print_push_status(), while suppressing the progress report. That would > make mails coming from the cron job much more pleasant to read. > > If you somehow can automatically squelch progress without -q for an > unattended invocation (e.g. cron jobs), then I wouldn't need to pass -q > and everything will be good. But if I have to pass -q in order to squelch > progress, I do not want that same -q to automatically also mean "no status > output", which is what your 3/3 is about, if I am reading the patch > correctly. That's all. Hmm. Doesn't that already work? pack-objects checks isatty(2) already before outputting progress, which means it should be suppressed when run via cron (the original poster is seeing it, though, which maybe means some crons allocate a terminal?). But it sounds like git already does what you want; this extra "-q" would really be more about shutting up the ref status. If you really wanted to control them separately (e.g., because your isatty check is not reliable), then maybe it should be split into "--quiet" and "--no-progress"? -Peff ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-05 21:17 ` Jeff King @ 2009-08-31 18:33 ` Sebastian Pipping 2009-08-31 19:28 ` Jeff King 0 siblings, 1 reply; 19+ messages in thread From: Sebastian Pipping @ 2009-08-31 18:33 UTC (permalink / raw) To: Jeff King Cc: Junio C Hamano, Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Pau Garcia i Quiles, git Hello! I run git push in a cron job, too. I want mails in error cases only so I need git push to print errors but _only_ errors to stderr. That seems impossible with 1.6.4.* and related to what you're discussing here. Does the patch you're building address that case already? has it been applied to any branch already? I got a bit lost in this thread, sorry. Sebastian ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-31 18:33 ` Sebastian Pipping @ 2009-08-31 19:28 ` Jeff King 2009-08-31 19:39 ` Sebastian Pipping 0 siblings, 1 reply; 19+ messages in thread From: Jeff King @ 2009-08-31 19:28 UTC (permalink / raw) To: Sebastian Pipping Cc: Junio C Hamano, Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Pau Garcia i Quiles, git On Mon, Aug 31, 2009 at 08:33:02PM +0200, Sebastian Pipping wrote: > I run git push in a cron job, too. I want mails in error cases only > so I need git push to print errors but _only_ errors to stderr. That > seems impossible with 1.6.4.* and related to what you're discussing here. > > Does the patch you're building address that case already? has it been > applied to any branch already? I got a bit lost in this thread, sorry. Junio applied the series, and it is in 'master' right now (and so should be part of the upcoming 1.6.5). Using "git push -q" will do what you want, but playing with it a bit, I think there is one bit missing from the original series: -- >8 -- Subject: [PATCH] push: teach --quiet to suppress "Everything up-to-date" This should have been part of 481c7a6, whose goal was to make "git push -q" silent unless there is an error. Signed-off-by: Jeff King <peff@peff.net> --- transport.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/transport.c b/transport.c index ce91387..f2bd998 100644 --- a/transport.c +++ b/transport.c @@ -908,7 +908,7 @@ int transport_push(struct transport *transport, update_tracking_ref(transport->remote, ref, verbose); } - if (!ret && !refs_pushed(remote_refs)) + if (!quiet && !ret && !refs_pushed(remote_refs)) fprintf(stderr, "Everything up-to-date\n"); return ret; } -- 1.6.4.2.372.gf7961.dirty ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] transport: don't show push status if --quiet is given 2009-08-31 19:28 ` Jeff King @ 2009-08-31 19:39 ` Sebastian Pipping 0 siblings, 0 replies; 19+ messages in thread From: Sebastian Pipping @ 2009-08-31 19:39 UTC (permalink / raw) To: Jeff King Cc: Junio C Hamano, Nicolas Pitre, Shawn O. Pearce, Albert Astals Cid, Pau Garcia i Quiles, git Jeff King wrote: > Junio applied the series, and it is in 'master' right now (and so should > be part of the upcoming 1.6.5). > > Using "git push -q" will do what you want, That's great news. Thanks for the quick reply. > but playing with it a bit, I > think there is one bit missing from the original series: > > -- >8 -- > Subject: [PATCH] push: teach --quiet to suppress "Everything up-to-date" > > This should have been part of 481c7a6, whose goal was to > make "git push -q" silent unless there is an error. > > Signed-off-by: Jeff King <peff@peff.net> > --- > transport.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/transport.c b/transport.c > index ce91387..f2bd998 100644 > --- a/transport.c > +++ b/transport.c > @@ -908,7 +908,7 @@ int transport_push(struct transport *transport, > update_tracking_ref(transport->remote, ref, verbose); > } > > - if (!ret && !refs_pushed(remote_refs)) > + if (!quiet && !ret && !refs_pushed(remote_refs)) > fprintf(stderr, "Everything up-to-date\n"); > return ret; > } Would be great to have that patch in too. Sebastian ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2009-08-31 19:47 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-08-04 21:27 Making git push output quieter Albert Astals Cid 2009-08-04 22:20 ` Pau Garcia i Quiles 2009-08-05 19:13 ` Albert Astals Cid 2009-08-05 19:26 ` Shawn O. Pearce 2009-08-05 19:51 ` Nicolas Pitre 2009-08-05 20:19 ` Jeff King 2009-08-05 20:22 ` [RFC/PATCH 1/3] push: add --quiet flag Jeff King 2009-08-05 20:22 ` [PATCH 2/3] transport: pass "quiet" flag to pack-objects Jeff King 2009-08-05 20:23 ` [PATCH 3/3] transport: don't show push status if --quiet is given Jeff King 2009-08-05 20:27 ` Sverre Rabbelier 2009-08-05 20:29 ` Avery Pennarun 2009-08-05 20:30 ` Sverre Rabbelier 2009-08-05 20:39 ` Junio C Hamano 2009-08-05 20:48 ` Jeff King 2009-08-05 21:01 ` Junio C Hamano 2009-08-05 21:17 ` Jeff King 2009-08-31 18:33 ` Sebastian Pipping 2009-08-31 19:28 ` Jeff King 2009-08-31 19:39 ` Sebastian Pipping
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).