Re: Making git push output quieter
From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:47:09
Subsystem:
the rest · Maintainer:
Linus Torvalds
Albert Astals Cid [off-list ref] wrote:
A Dimecres, 5 d'agost de 2009, Pau Garcia i Quiles va escriure:quoted
On Tue, Aug 4, 2009 at 11:27 PM, Albert Astals Cid[off-list ref] wrote:quoted
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.
...
quoted
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 <redacted>
---
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.