Skip to content

Commit

Permalink
convert: display progress for filtered objects that have been delayed
Browse files Browse the repository at this point in the history
In 2841e8f ("convert: add "status=delayed" to filter process protocol",
2017-06-30) we taught the filter process protocol to delayed responses.
These responses are processed after the "Checking out files" phase.
If the processing takes noticeable time, then the user might think Git
is stuck.

Display the progress of the delayed responses to let the user know that
Git is still processing objects. This works very well for objects that
can be filtered quickly. If filtering of an individual object takes
noticeable time, then the user might still think that Git is stuck.
However, in that case the user would at least know what Git is doing.

It would be technical more correct to display "Checking out files whose
content filtering has been delayed". For brevity we only print
"Filtering content".

The finish_delayed_checkout() call was moved below the stop_progress()
call in unpack-trees.c to ensure that the "Checking out files" progress
is properly stopped before the "Filtering content" progress starts in
finish_delayed_checkout().

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Suggested-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
larsxschneider authored and gitster committed Aug 24, 2017
1 parent 3dc57eb commit 52f1d62
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion entry.c
Expand Up @@ -3,6 +3,7 @@
#include "dir.h"
#include "streaming.h"
#include "submodule.h"
#include "progress.h"

static void create_directories(const char *path, int path_len,
const struct checkout *state)
Expand Down Expand Up @@ -161,16 +162,23 @@ static int remove_available_paths(struct string_list_item *item, void *cb_data)
int finish_delayed_checkout(struct checkout *state)
{
int errs = 0;
unsigned delayed_object_count;
off_t filtered_bytes = 0;
struct string_list_item *filter, *path;
struct progress *progress;
struct delayed_checkout *dco = state->delayed_checkout;

if (!state->delayed_checkout)
return errs;

dco->state = CE_RETRY;
delayed_object_count = dco->paths.nr;
progress = start_progress_delay(
_("Filtering content"), delayed_object_count, 50, 1);
while (dco->filters.nr > 0) {
for_each_string_list_item(filter, &dco->filters) {
struct string_list available_paths = STRING_LIST_INIT_NODUP;
display_progress(progress, delayed_object_count - dco->paths.nr);

if (!async_query_available_blobs(filter->string, &available_paths)) {
/* Filter reported an error */
Expand Down Expand Up @@ -216,11 +224,17 @@ int finish_delayed_checkout(struct checkout *state)
}
ce = index_file_exists(state->istate, path->string,
strlen(path->string), 0);
errs |= (ce ? checkout_entry(ce, state, NULL) : 1);
if (ce) {
errs |= checkout_entry(ce, state, NULL);
filtered_bytes += ce->ce_stat_data.sd_size;
display_throughput(progress, filtered_bytes);
} else
errs = 1;
}
}
string_list_remove_empty_items(&dco->filters, 0);
}
stop_progress(&progress);
string_list_clear(&dco->filters, 0);

/* At this point we should not have any delayed paths anymore. */
Expand Down
2 changes: 1 addition & 1 deletion unpack-trees.c
Expand Up @@ -394,8 +394,8 @@ static int check_updates(struct unpack_trees_options *o)
}
}
}
errs |= finish_delayed_checkout(&state);
stop_progress(&progress);
errs |= finish_delayed_checkout(&state);
if (o->update)
git_attr_set_direction(GIT_ATTR_CHECKIN, NULL);
return errs != 0;
Expand Down

0 comments on commit 52f1d62

Please sign in to comment.