Skip to content

Commit d941cc4

Browse files
avargitster
authored andcommitted
bundle: show progress on "unbundle"
The "unbundle" command added in 2e0afaf (Add git-bundle: move objects and references by archive, 2007-02-22) did not show progress output, even though the underlying API learned how to show progress in be042af (Teach progress eye-candy to fetch_refs_from_bundle(), 2011-09-18). Now we'll show "Unbundling objects" using the new --progress-title option to "git index-pack", to go with its existing "Receiving objects" and "Indexing objects" (which it shows when invoked with "--stdin", and with a pack file, respectively). Unlike "git bundle create" we don't handle "--quiet" here, nor "--all-progress" and "--all-progress-implied". Those are all specific to "create" (and "verify", in the case of "--quiet"). The structure of the existing documentation is a bit unclear, e.g. the documentation for the "--quiet" option added in 79862b6 (bundle-create: progress output control, 2019-11-10) only describes how it works for "create", and not for "verify". That and other issues in it should be fixed, but I'd like to avoid untangling that mess right now. Let's just support the standard "--no-progress" implicitly here, and leave cleaning up the general behavior of "git bundle" for a later change. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f46c46e commit d941cc4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Documentation/git-bundle.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SYNOPSIS
1313
[--version=<version>] <file> <git-rev-list-args>
1414
'git bundle' verify [-q | --quiet] <file>
1515
'git bundle' list-heads <file> [<refname>...]
16-
'git bundle' unbundle <file> [<refname>...]
16+
'git bundle' unbundle [--progress] <file> [<refname>...]
1717

1818
DESCRIPTION
1919
-----------

builtin/bundle.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
162162
struct bundle_header header = BUNDLE_HEADER_INIT;
163163
int bundle_fd = -1;
164164
int ret;
165+
int progress = isatty(2);
166+
165167
struct option options[] = {
168+
OPT_BOOL(0, "progress", &progress,
169+
N_("show progress meter")),
166170
OPT_END()
167171
};
168172
char *bundle_file;
@@ -178,6 +182,9 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
178182
}
179183
if (!startup_info->have_repository)
180184
die(_("Need a repository to unbundle."));
185+
if (progress)
186+
strvec_pushl(&extra_index_pack_args, "-v", "--progress-title",
187+
_("Unbundling objects"), NULL);
181188
ret = !!unbundle(the_repository, &header, bundle_fd,
182189
&extra_index_pack_args) ||
183190
list_bundle_refs(&header, argc, argv);

0 commit comments

Comments
 (0)