Browse Source

builtin/repack.c: extract showing progress to a variable

We only ask whether stderr is a tty before calling
'prune_packed_objects()', but the subsequent patch will add another use.

Extract this check into a variable so that both can use it without
having to call 'isatty()' twice.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Taylor Blau 4 years ago committed by Junio C Hamano
parent
commit
5f18e31f46
  1. 3
      builtin/repack.c

3
builtin/repack.c

@ -446,6 +446,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
struct strbuf line = STRBUF_INIT; struct strbuf line = STRBUF_INIT;
int i, ext, ret; int i, ext, ret;
FILE *out; FILE *out;
int show_progress = isatty(2);


/* variables to be filled by option parsing */ /* variables to be filled by option parsing */
int pack_everything = 0; int pack_everything = 0;
@ -719,7 +720,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
} }
strbuf_release(&buf); strbuf_release(&buf);
} }
if (!po_args.quiet && isatty(2)) if (!po_args.quiet && show_progress)
opts |= PRUNE_PACKED_VERBOSE; opts |= PRUNE_PACKED_VERBOSE;
prune_packed_objects(opts); prune_packed_objects(opts);



Loading…
Cancel
Save