@matheusbsbs / matheus-bagliano / commits / 4f36627518
Fork 0

pack-objects: split implications of --all-progress from progress activation

Currently the --all-progress flag is used to use force progress display during the writing object phase even if output goes to stdout which is primarily the case during a push operation. This has the unfortunate side effect of forcing progress display even if stderr is not a terminal. Let's introduce the --all-progress-implied argument which has the same intent except for actually forcing the activation of any progress display. With this, progress display will be automatically inhibited whenever stderr is not a terminal, or full progress display will be included otherwise. This should let people use 'git push' within a cron job without filling their logs with useless percentage displays. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Tested-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nicolas Pitre committed Nov 23, 2009 at 12:43 UTC 4f366275189c06ec26c01ee5ace2f3831b2aa46a
4 files changed +20 -5
Documentation/git-pack-objects.txt
+9 -3
@@ -9,8 +9,9 @@ git-pack-objects - Create a packed archive of objects
9 SYNOPSIS
10 --------
11 [verse]
12 -'git pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
13 - [--local] [--incremental] [--window=N] [--depth=N] [--all-progress]
12 +'git pack-objects' [-q | --progress | --all-progress] [--all-progress-implied]
13 + [--no-reuse-delta] [--delta-base-offset] [--non-empty]
14 + [--local] [--incremental] [--window=N] [--depth=N]
15 [--revs [--unpacked | --all]*] [--stdout | base-name]
16 [--keep-true-parents] < object-list
17
@@ -137,7 +138,7 @@ base-name::
138
139 --all-progress::
140 When --stdout is specified then progress report is
140 - displayed during the object count and deltification phases
141 + displayed during the object count and compression phases
142 but inhibited during the write-out phase. The reason is
143 that in some cases the output stream is directly linked
144 to another command which may wish to display progress
@@ -146,6 +147,11 @@ base-name::
147 report for the write-out phase as well even if --stdout is
148 used.
149
150 +--all-progress-implied::
151 + This is used to imply --all-progress whenever progress display
152 + is activated. Unlike --all-progress this flag doesn't actually
153 + force any progress display by itself.
154 +
155 -q::
156 This flag makes the command not to report its progress
157 on the standard error stream.
builtin-pack-objects.c
+9
@@ -24,6 +24,7 @@
24
25 static const char pack_usage[] =
26 "git pack-objects [{ -q | --progress | --all-progress }]\n"
27 + " [--all-progress-implied]\n"
28 " [--max-pack-size=N] [--local] [--incremental]\n"
29 " [--window=N] [--window-memory=N] [--depth=N]\n"
30 " [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset]\n"
@@ -2122,6 +2123,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2123 {
2124 int use_internal_rev_list = 0;
2125 int thin = 0;
2126 + int all_progress_implied = 0;
2127 uint32_t i;
2128 const char **rp_av;
2129 int rp_ac_alloc = 64;
@@ -2221,6 +2223,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2223 progress = 2;
2224 continue;
2225 }
2226 + if (!strcmp("--all-progress-implied", arg)) {
2227 + all_progress_implied = 1;
2228 + continue;
2229 + }
2230 if (!strcmp("-q", arg)) {
2231 progress = 0;
2232 continue;
@@ -2329,6 +2335,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2335 delta_search_threads = online_cpus();
2336 #endif
2337
2338 + if (progress && all_progress_implied)
2339 + progress = 2;
2340 +
2341 prepare_packed_git();
2342
2343 if (progress)
builtin-send-pack.c
+1 -1
@@ -38,7 +38,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
38 */
39 const char *argv[] = {
40 "pack-objects",
41 - "--all-progress",
41 + "--all-progress-implied",
42 "--revs",
43 "--stdout",
44 NULL,
bundle.c
+1 -1
@@ -351,7 +351,7 @@ int create_bundle(struct bundle_header *header, const char *path,
351
352 /* write pack */
353 argv_pack[0] = "pack-objects";
354 - argv_pack[1] = "--all-progress";
354 + argv_pack[1] = "--all-progress-implied";
355 argv_pack[2] = "--stdout";
356 argv_pack[3] = "--thin";
357 argv_pack[4] = NULL;