Skip to content

Commit

Permalink
Teach progress eye-candy to fetch_refs_from_bundle()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
gitster committed Sep 19, 2011
1 parent ec014ea commit be042af
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion builtin/bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
} else if (!strcmp(cmd, "unbundle")) {
if (!startup_info->have_repository)
die(_("Need a repository to unbundle."));
return !!unbundle(&header, bundle_fd) ||
return !!unbundle(&header, bundle_fd, 0) ||
list_bundle_refs(&header, argc, argv);
} else
usage(builtin_bundle_usage);
Expand Down
7 changes: 5 additions & 2 deletions bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,15 @@ int create_bundle(struct bundle_header *header, const char *path,
return 0;
}

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

if (flags & BUNDLE_VERBOSE)
argv_index_pack[3] = "-v";

if (verify_bundle(header, 0))
return -1;
memset(&ip, 0, sizeof(ip));
Expand Down
3 changes: 2 additions & 1 deletion bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ int read_bundle_header(const char *path, struct bundle_header *header);
int create_bundle(struct bundle_header *header, const char *path,
int argc, const char **argv);
int verify_bundle(struct bundle_header *header, int verbose);
int unbundle(struct bundle_header *header, int bundle_fd);
#define BUNDLE_VERBOSE 1
int unbundle(struct bundle_header *header, int bundle_fd, int flags);
int list_bundle_refs(struct bundle_header *header,
int argc, const char **argv);

Expand Down
3 changes: 2 additions & 1 deletion transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ static int fetch_refs_from_bundle(struct transport *transport,
int nr_heads, struct ref **to_fetch)
{
struct bundle_transport_data *data = transport->data;
return unbundle(&data->header, data->fd);
return unbundle(&data->header, data->fd,
transport->progress ? BUNDLE_VERBOSE : 0);
}

static int close_bundle(struct transport *transport)
Expand Down

0 comments on commit be042af

Please sign in to comment.