summaryrefslogtreecommitdiff
path: root/builtin/repack.c
diff options
context:
space:
mode:
authorLibravatar Taylor Blau <me@ttaylorr.com>2021-09-28 21:55:15 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-28 21:20:56 -0700
commit5f18e31f4642f4daf398d0903e3fb3233b86f174 (patch)
tree4d7df4c5a5a0859113a0d7d4f56569ce0096480a /builtin/repack.c
parentbuiltin/repack.c: rename variables that deal with non-kept packs (diff)
downloadtgif-5f18e31f4642f4daf398d0903e3fb3233b86f174.tar.xz
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>
Diffstat (limited to 'builtin/repack.c')
-rw-r--r--builtin/repack.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index fb745a7a0f..ead4f48fda 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -446,6 +446,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
struct strbuf line = STRBUF_INIT;
int i, ext, ret;
FILE *out;
+ int show_progress = isatty(2);
/* variables to be filled by option parsing */
int pack_everything = 0;
@@ -719,7 +720,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
}
strbuf_release(&buf);
}
- if (!po_args.quiet && isatty(2))
+ if (!po_args.quiet && show_progress)
opts |= PRUNE_PACKED_VERBOSE;
prune_packed_objects(opts);