157
158
available = string_list_lookup(available_paths, item->string);
159
if (available)
160
- available->util = (void *)item->string;
160
+ available->util = item->util;
161
return !available;
162
}
163
164
-int finish_delayed_checkout(struct checkout *state, int *nr_checkouts,
165
- int show_progress)
164
+int finish_delayed_checkout(struct checkout *state, int show_progress)
165
{
166
int errs = 0;
167
unsigned processed_paths = 0;
226
strlen(path->string), 0);
227
if (ce) {
228
display_progress(progress, ++processed_paths);
230
- errs |= checkout_entry(ce, state, NULL, nr_checkouts);
229
+ errs |= checkout_entry(ce, state, NULL, path->util);
230
filtered_bytes += ce->ce_stat_data.sd_size;
231
display_throughput(progress, filtered_bytes);
232
} else
265
266
/* Note: ca is used (and required) iff the entry refers to a regular file. */
267
static int write_entry(struct cache_entry *ce, char *path, struct conv_attrs *ca,
269
- const struct checkout *state, int to_tempfile)
268
+ const struct checkout *state, int to_tempfile,
269
+ int *nr_checkouts)
270
{
271
unsigned int ce_mode_s_ifmt = ce->ce_mode & S_IFMT;
272
struct delayed_checkout *dco = state->delayed_checkout;
279
struct stat st;
280
const struct submodule *sub;
281
struct checkout_metadata meta;
282
+ static int scratch_nr_checkouts;
283
284
clone_checkout_metadata(&meta, &state->meta, &ce->oid);
285
334
ret = async_convert_to_working_tree_ca(ca, ce->name,
335
new_blob, size,
336
&buf, &meta, dco);
336
- if (ret && string_list_has_string(&dco->paths, ce->name)) {
337
- free(new_blob);
338
- goto delayed;
337
+ if (ret) {
338
+ struct string_list_item *item =
339
+ string_list_lookup(&dco->paths, ce->name);
340
+ if (item) {
341
+ item->util = nr_checkouts ? nr_checkouts
342
+ : &scratch_nr_checkouts;
343
+ free(new_blob);
344
+ goto delayed;
345
+ }
346
}
347
} else {
348
ret = convert_to_working_tree_ca(ca, ce->name, new_blob,
399
ce->name);
400
update_ce_after_write(state, ce , &st);
401
}
402
+ if (nr_checkouts)
403
+ (*nr_checkouts)++;
404
delayed:
405
return 0;
406
}
485
convert_attrs(state->istate, &ca_buf, ce->name);
486
ca = &ca_buf;
487
}
479
- return write_entry(ce, topath, ca, state, 1);
488
+ return write_entry(ce, topath, ca, state, 1, nr_checkouts);
489
}
490
491
strbuf_reset(&path);
549
550
create_directories(path.buf, path.len, state);
551
543
- if (nr_checkouts)
544
- (*nr_checkouts)++;
545
-
552
if (S_ISREG(ce->ce_mode) && !ca) {
553
convert_attrs(state->istate, &ca_buf, ce->name);
554
ca = &ca_buf;
555
}
556
551
- if (!enqueue_checkout(ce, ca))
557
+ if (!enqueue_checkout(ce, ca, nr_checkouts))
558
return 0;
559
554
- return write_entry(ce, path.buf, ca, state, 0);
560
+ return write_entry(ce, path.buf, ca, state, 0, nr_checkouts);
561
}
562
563
void unlink_entry(const struct cache_entry *ce)