Skip to content

Commit 7fbbd3e

Browse files
committed
Merge branch 'ls/convert-filter-progress'
The codepath to call external process filter for smudge/clean operation learned to show the progress meter. * ls/convert-filter-progress: convert: display progress for filtered objects that have been delayed
2 parents 8e36002 + 52f1d62 commit 7fbbd3e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

entry.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "dir.h"
44
#include "streaming.h"
55
#include "submodule.h"
6+
#include "progress.h"
67

78
static void create_directories(const char *path, int path_len,
89
const struct checkout *state)
@@ -161,16 +162,22 @@ static int remove_available_paths(struct string_list_item *item, void *cb_data)
161162
int finish_delayed_checkout(struct checkout *state)
162163
{
163164
int errs = 0;
165+
unsigned delayed_object_count;
166+
off_t filtered_bytes = 0;
164167
struct string_list_item *filter, *path;
168+
struct progress *progress;
165169
struct delayed_checkout *dco = state->delayed_checkout;
166170

167171
if (!state->delayed_checkout)
168172
return errs;
169173

170174
dco->state = CE_RETRY;
175+
delayed_object_count = dco->paths.nr;
176+
progress = start_delayed_progress(_("Filtering content"), delayed_object_count);
171177
while (dco->filters.nr > 0) {
172178
for_each_string_list_item(filter, &dco->filters) {
173179
struct string_list available_paths = STRING_LIST_INIT_NODUP;
180+
display_progress(progress, delayed_object_count - dco->paths.nr);
174181

175182
if (!async_query_available_blobs(filter->string, &available_paths)) {
176183
/* Filter reported an error */
@@ -216,11 +223,17 @@ int finish_delayed_checkout(struct checkout *state)
216223
}
217224
ce = index_file_exists(state->istate, path->string,
218225
strlen(path->string), 0);
219-
errs |= (ce ? checkout_entry(ce, state, NULL) : 1);
226+
if (ce) {
227+
errs |= checkout_entry(ce, state, NULL);
228+
filtered_bytes += ce->ce_stat_data.sd_size;
229+
display_throughput(progress, filtered_bytes);
230+
} else
231+
errs = 1;
220232
}
221233
}
222234
string_list_remove_empty_items(&dco->filters, 0);
223235
}
236+
stop_progress(&progress);
224237
string_list_clear(&dco->filters, 0);
225238

226239
/* At this point we should not have any delayed paths anymore. */

unpack-trees.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ static int check_updates(struct unpack_trees_options *o)
383383
}
384384
}
385385
}
386-
errs |= finish_delayed_checkout(&state);
387386
stop_progress(&progress);
387+
errs |= finish_delayed_checkout(&state);
388388
if (o->update)
389389
git_attr_set_direction(GIT_ATTR_CHECKIN, NULL);
390390
return errs != 0;

0 commit comments

Comments
 (0)