зеркало из https://github.com/microsoft/git.git
Merge branch 'rs/unpack-trees-reduce-file-scope-global' into maint
Code cleanup. * rs/unpack-trees-reduce-file-scope-global: unpack-trees: pass checkout state explicitly to check_updates()
This commit is contained in:
Коммит
633212b246
|
@ -218,8 +218,8 @@ static void unlink_entry(const struct cache_entry *ce)
|
||||||
schedule_dir_for_removal(ce->name, ce_namelen(ce));
|
schedule_dir_for_removal(ce->name, ce_namelen(ce));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct checkout state;
|
static int check_updates(struct unpack_trees_options *o,
|
||||||
static int check_updates(struct unpack_trees_options *o)
|
const struct checkout *state)
|
||||||
{
|
{
|
||||||
unsigned cnt = 0, total = 0;
|
unsigned cnt = 0, total = 0;
|
||||||
struct progress *progress = NULL;
|
struct progress *progress = NULL;
|
||||||
|
@ -264,7 +264,7 @@ static int check_updates(struct unpack_trees_options *o)
|
||||||
display_progress(progress, ++cnt);
|
display_progress(progress, ++cnt);
|
||||||
ce->ce_flags &= ~CE_UPDATE;
|
ce->ce_flags &= ~CE_UPDATE;
|
||||||
if (o->update && !o->dry_run) {
|
if (o->update && !o->dry_run) {
|
||||||
errs |= checkout_entry(ce, &state, NULL);
|
errs |= checkout_entry(ce, state, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1094,6 +1094,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
|
||||||
int i, ret;
|
int i, ret;
|
||||||
static struct cache_entry *dfc;
|
static struct cache_entry *dfc;
|
||||||
struct exclude_list el;
|
struct exclude_list el;
|
||||||
|
struct checkout state;
|
||||||
|
|
||||||
if (len > MAX_UNPACK_TREES)
|
if (len > MAX_UNPACK_TREES)
|
||||||
die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
|
die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
|
||||||
|
@ -1239,7 +1240,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
|
||||||
}
|
}
|
||||||
|
|
||||||
o->src_index = NULL;
|
o->src_index = NULL;
|
||||||
ret = check_updates(o) ? (-2) : 0;
|
ret = check_updates(o, &state) ? (-2) : 0;
|
||||||
if (o->dst_index) {
|
if (o->dst_index) {
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (!o->result.cache_tree)
|
if (!o->result.cache_tree)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче