checkout: no progress messages if !isatty(2).

If stderr isn't a tty, we shouldn't be printing incremental progress messages. In particular, this affects 'git checkout -f . >&logfile' unless you provided -q. And git-new-workdir has no way to provide -q. It would probably be better to have progress.c check isatty(2) all the time, but that wouldn't allow things like 'git push --progress' to force progress reporting to on, so I won't try to solve the general case right now. Actual fix suggested by Jeff King. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Avery Pennarun committed May 24, 2012 at 02:12 UTC e9fc64c60a71a190016a9e9bcb81195a0fa0d9f4
1 file changed +2 -2
builtin/checkout.c
+2 -2
@@ -343,7 +343,7 @@ static int reset_tree(struct tree *tree, struct checkout_opts *o, int worktree)
343 opts.reset = 1;
344 opts.merge = 1;
345 opts.fn = oneway_merge;
346 - opts.verbose_update = !o->quiet;
346 + opts.verbose_update = !o->quiet && isatty(2);
347 opts.src_index = &the_index;
348 opts.dst_index = &the_index;
349 parse_tree(tree);
@@ -420,7 +420,7 @@ static int merge_working_tree(struct checkout_opts *opts,
420 topts.update = 1;
421 topts.merge = 1;
422 topts.gently = opts->merge && old->commit;
423 - topts.verbose_update = !opts->quiet;
423 + topts.verbose_update = !opts->quiet && isatty(2);
424 topts.fn = twoway_merge;
425 if (opts->overwrite_ignore) {
426 topts.dir = xcalloc(1, sizeof(*topts.dir));