Skip to content

Commit 5f18e31

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a169166 commit 5f18e31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin/repack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
446446
struct strbuf line = STRBUF_INIT;
447447
int i, ext, ret;
448448
FILE *out;
449+
int show_progress = isatty(2);
449450

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

0 commit comments

Comments
 (0)