Skip to content

Commit 4f36627

Browse files
npitregitster
authored andcommitted
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 <[email protected]> Tested-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b624b4 commit 4f36627

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

Documentation/git-pack-objects.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ git-pack-objects - Create a packed archive of objects
99
SYNOPSIS
1010
--------
1111
[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]
1415
[--revs [--unpacked | --all]*] [--stdout | base-name]
1516
[--keep-true-parents] < object-list
1617

@@ -137,7 +138,7 @@ base-name::
137138

138139
--all-progress::
139140
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
141142
but inhibited during the write-out phase. The reason is
142143
that in some cases the output stream is directly linked
143144
to another command which may wish to display progress
@@ -146,6 +147,11 @@ base-name::
146147
report for the write-out phase as well even if --stdout is
147148
used.
148149

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+
149155
-q::
150156
This flag makes the command not to report its progress
151157
on the standard error stream.

builtin-pack-objects.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
static const char pack_usage[] =
2626
"git pack-objects [{ -q | --progress | --all-progress }]\n"
27+
" [--all-progress-implied]\n"
2728
" [--max-pack-size=N] [--local] [--incremental]\n"
2829
" [--window=N] [--window-memory=N] [--depth=N]\n"
2930
" [--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)
21222123
{
21232124
int use_internal_rev_list = 0;
21242125
int thin = 0;
2126+
int all_progress_implied = 0;
21252127
uint32_t i;
21262128
const char **rp_av;
21272129
int rp_ac_alloc = 64;
@@ -2221,6 +2223,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
22212223
progress = 2;
22222224
continue;
22232225
}
2226+
if (!strcmp("--all-progress-implied", arg)) {
2227+
all_progress_implied = 1;
2228+
continue;
2229+
}
22242230
if (!strcmp("-q", arg)) {
22252231
progress = 0;
22262232
continue;
@@ -2329,6 +2335,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
23292335
delta_search_threads = online_cpus();
23302336
#endif
23312337

2338+
if (progress && all_progress_implied)
2339+
progress = 2;
2340+
23322341
prepare_packed_git();
23332342

23342343
if (progress)

builtin-send-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
3838
*/
3939
const char *argv[] = {
4040
"pack-objects",
41-
"--all-progress",
41+
"--all-progress-implied",
4242
"--revs",
4343
"--stdout",
4444
NULL,

bundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ int create_bundle(struct bundle_header *header, const char *path,
351351

352352
/* write pack */
353353
argv_pack[0] = "pack-objects";
354-
argv_pack[1] = "--all-progress";
354+
argv_pack[1] = "--all-progress-implied";
355355
argv_pack[2] = "--stdout";
356356
argv_pack[3] = "--thin";
357357
argv_pack[4] = NULL;

0 commit comments

Comments
 (0)