Skip to content

Commit

Permalink
pack-objects: split implications of --all-progress from progress acti…
Browse files Browse the repository at this point in the history
…vation

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>
  • Loading branch information
npitre authored and gitster committed Nov 24, 2009
1 parent 0b624b4 commit 4f36627
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
12 changes: 9 additions & 3 deletions Documentation/git-pack-objects.txt
Expand Up @@ -9,8 +9,9 @@ git-pack-objects - Create a packed archive of objects
SYNOPSIS
--------
[verse]
'git pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
[--local] [--incremental] [--window=N] [--depth=N] [--all-progress]
'git pack-objects' [-q | --progress | --all-progress] [--all-progress-implied]
[--no-reuse-delta] [--delta-base-offset] [--non-empty]
[--local] [--incremental] [--window=N] [--depth=N]
[--revs [--unpacked | --all]*] [--stdout | base-name]
[--keep-true-parents] < object-list

Expand Down Expand Up @@ -137,7 +138,7 @@ base-name::

--all-progress::
When --stdout is specified then progress report is
displayed during the object count and deltification phases
displayed during the object count and compression phases
but inhibited during the write-out phase. The reason is
that in some cases the output stream is directly linked
to another command which may wish to display progress
Expand All @@ -146,6 +147,11 @@ base-name::
report for the write-out phase as well even if --stdout is
used.

--all-progress-implied::
This is used to imply --all-progress whenever progress display
is activated. Unlike --all-progress this flag doesn't actually
force any progress display by itself.

-q::
This flag makes the command not to report its progress
on the standard error stream.
Expand Down
9 changes: 9 additions & 0 deletions builtin-pack-objects.c
Expand Up @@ -24,6 +24,7 @@

static const char pack_usage[] =
"git pack-objects [{ -q | --progress | --all-progress }]\n"
" [--all-progress-implied]\n"
" [--max-pack-size=N] [--local] [--incremental]\n"
" [--window=N] [--window-memory=N] [--depth=N]\n"
" [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset]\n"
Expand Down Expand Up @@ -2122,6 +2123,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
{
int use_internal_rev_list = 0;
int thin = 0;
int all_progress_implied = 0;
uint32_t i;
const char **rp_av;
int rp_ac_alloc = 64;
Expand Down Expand Up @@ -2221,6 +2223,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
progress = 2;
continue;
}
if (!strcmp("--all-progress-implied", arg)) {
all_progress_implied = 1;
continue;
}
if (!strcmp("-q", arg)) {
progress = 0;
continue;
Expand Down Expand Up @@ -2329,6 +2335,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
delta_search_threads = online_cpus();
#endif

if (progress && all_progress_implied)
progress = 2;

prepare_packed_git();

if (progress)
Expand Down
2 changes: 1 addition & 1 deletion builtin-send-pack.c
Expand Up @@ -38,7 +38,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
*/
const char *argv[] = {
"pack-objects",
"--all-progress",
"--all-progress-implied",
"--revs",
"--stdout",
NULL,
Expand Down
2 changes: 1 addition & 1 deletion bundle.c
Expand Up @@ -351,7 +351,7 @@ int create_bundle(struct bundle_header *header, const char *path,

/* write pack */
argv_pack[0] = "pack-objects";
argv_pack[1] = "--all-progress";
argv_pack[1] = "--all-progress-implied";
argv_pack[2] = "--stdout";
argv_pack[3] = "--thin";
argv_pack[4] = NULL;
Expand Down

0 comments on commit 4f36627

Please sign in to comment.