Skip to content

Commit be042af

Browse files
committed
Teach progress eye-candy to fetch_refs_from_bundle()
With the usual "git" transport, a large-ish transfer with "git fetch" and "git pull" give progress eye-candy to avoid boring users. However, not when they are reading from a bundle. I.e. $ git pull ../git-bundle.bndl master This teaches bundle.c:unbundle() to give "-v" option to index-pack and tell it to give progress bar when transport decides it is necessary. The operation in the other direction, "git bundle create", could also learn to honor --quiet but that is a separate issue. Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec014ea commit be042af

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

builtin/bundle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
5858
} else if (!strcmp(cmd, "unbundle")) {
5959
if (!startup_info->have_repository)
6060
die(_("Need a repository to unbundle."));
61-
return !!unbundle(&header, bundle_fd) ||
61+
return !!unbundle(&header, bundle_fd, 0) ||
6262
list_bundle_refs(&header, argc, argv);
6363
} else
6464
usage(builtin_bundle_usage);

bundle.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,15 @@ int create_bundle(struct bundle_header *header, const char *path,
380380
return 0;
381381
}
382382

383-
int unbundle(struct bundle_header *header, int bundle_fd)
383+
int unbundle(struct bundle_header *header, int bundle_fd, int flags)
384384
{
385385
const char *argv_index_pack[] = {"index-pack",
386-
"--fix-thin", "--stdin", NULL};
386+
"--fix-thin", "--stdin", NULL, NULL};
387387
struct child_process ip;
388388

389+
if (flags & BUNDLE_VERBOSE)
390+
argv_index_pack[3] = "-v";
391+
389392
if (verify_bundle(header, 0))
390393
return -1;
391394
memset(&ip, 0, sizeof(ip));

bundle.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ int read_bundle_header(const char *path, struct bundle_header *header);
1818
int create_bundle(struct bundle_header *header, const char *path,
1919
int argc, const char **argv);
2020
int verify_bundle(struct bundle_header *header, int verbose);
21-
int unbundle(struct bundle_header *header, int bundle_fd);
21+
#define BUNDLE_VERBOSE 1
22+
int unbundle(struct bundle_header *header, int bundle_fd, int flags);
2223
int list_bundle_refs(struct bundle_header *header,
2324
int argc, const char **argv);
2425

transport.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,8 @@ static int fetch_refs_from_bundle(struct transport *transport,
431431
int nr_heads, struct ref **to_fetch)
432432
{
433433
struct bundle_transport_data *data = transport->data;
434-
return unbundle(&data->header, data->fd);
434+
return unbundle(&data->header, data->fd,
435+
transport->progress ? BUNDLE_VERBOSE : 0);
435436
}
436437

437438
static int close_bundle(struct transport *transport)

0 commit comments

Comments
 (0)