Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c251
1 files changed, 132 insertions, 119 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index b82ad7e45d..4a5522bdb2 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -3,6 +3,9 @@
#include "repository.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
@@ -19,6 +22,7 @@
#include "promisor-remote.h"
#include "entry.h"
#include "parallel-checkout.h"
+#include "setup.h"
/*
* Error messages expected by scripts out of plumbing commands such as
@@ -66,8 +70,8 @@ static const char *unpack_plumbing_errors[NB_UNPACK_TREES_WARNING_TYPES] = {
};
#define ERRORMSG(o,type) \
- ( ((o) && (o)->msgs[(type)]) \
- ? ((o)->msgs[(type)]) \
+ ( ((o) && (o)->internal.msgs[(type)]) \
+ ? ((o)->internal.msgs[(type)]) \
: (unpack_plumbing_errors[(type)]) )
static const char *super_prefixed(const char *path, const char *super_prefix)
@@ -108,10 +112,10 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
const char *cmd)
{
int i;
- const char **msgs = opts->msgs;
+ const char **msgs = opts->internal.msgs;
const char *msg;
- strvec_init(&opts->msgs_to_free);
+ strvec_init(&opts->internal.msgs_to_free);
if (!strcmp(cmd, "checkout"))
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
@@ -129,7 +133,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
"Please commit your changes or stash them before you %s.")
: _("Your local changes to the following files would be overwritten by %s:\n%%s");
msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOT_UPTODATE_FILE] =
- strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
+ strvec_pushf(&opts->internal.msgs_to_free, msg, cmd, cmd);
msgs[ERROR_NOT_UPTODATE_DIR] =
_("Updating the following directories would lose untracked files in them:\n%s");
@@ -153,7 +157,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
"Please move or remove them before you %s.")
: _("The following untracked working tree files would be removed by %s:\n%%s");
msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] =
- strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
+ strvec_pushf(&opts->internal.msgs_to_free, msg, cmd, cmd);
if (!strcmp(cmd, "checkout"))
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
@@ -171,7 +175,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
"Please move or remove them before you %s.")
: _("The following untracked working tree files would be overwritten by %s:\n%%s");
msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] =
- strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
+ strvec_pushf(&opts->internal.msgs_to_free, msg, cmd, cmd);
/*
* Special case: ERROR_BIND_OVERLAP refers to a pair of paths, we
@@ -189,16 +193,16 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
msgs[WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN] =
_("The following paths were already present and thus not updated despite sparse patterns:\n%s");
- opts->show_all_errors = 1;
+ opts->internal.show_all_errors = 1;
/* rejected paths may not have a static buffer */
- for (i = 0; i < ARRAY_SIZE(opts->unpack_rejects); i++)
- opts->unpack_rejects[i].strdup_strings = 1;
+ for (i = 0; i < ARRAY_SIZE(opts->internal.unpack_rejects); i++)
+ opts->internal.unpack_rejects[i].strdup_strings = 1;
}
void clear_unpack_trees_porcelain(struct unpack_trees_options *opts)
{
- strvec_clear(&opts->msgs_to_free);
- memset(opts->msgs, 0, sizeof(opts->msgs));
+ strvec_clear(&opts->internal.msgs_to_free);
+ memset(opts->internal.msgs, 0, sizeof(opts->internal.msgs));
}
static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
@@ -210,7 +214,7 @@ static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
set |= CE_WT_REMOVE;
ce->ce_flags = (ce->ce_flags & ~clear) | set;
- return add_index_entry(&o->result, ce,
+ return add_index_entry(&o->internal.result, ce,
ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
}
@@ -218,7 +222,7 @@ static void add_entry(struct unpack_trees_options *o,
const struct cache_entry *ce,
unsigned int set, unsigned int clear)
{
- do_add_entry(o, dup_cache_entry(ce, &o->result), set, clear);
+ do_add_entry(o, dup_cache_entry(ce, &o->internal.result), set, clear);
}
/*
@@ -233,7 +237,7 @@ static int add_rejected_path(struct unpack_trees_options *o,
if (o->quiet)
return -1;
- if (!o->show_all_errors)
+ if (!o->internal.show_all_errors)
return error(ERRORMSG(o, e), super_prefixed(path,
o->super_prefix));
@@ -241,7 +245,7 @@ static int add_rejected_path(struct unpack_trees_options *o,
* Otherwise, insert in a list for future display by
* display_(error|warning)_msgs()
*/
- string_list_append(&o->unpack_rejects[e], path);
+ string_list_append(&o->internal.unpack_rejects[e], path);
return -1;
}
@@ -253,7 +257,7 @@ static void display_error_msgs(struct unpack_trees_options *o)
int e;
unsigned error_displayed = 0;
for (e = 0; e < NB_UNPACK_TREES_ERROR_TYPES; e++) {
- struct string_list *rejects = &o->unpack_rejects[e];
+ struct string_list *rejects = &o->internal.unpack_rejects[e];
if (rejects->nr > 0) {
int i;
@@ -281,7 +285,7 @@ static void display_warning_msgs(struct unpack_trees_options *o)
unsigned warning_displayed = 0;
for (e = NB_UNPACK_TREES_ERROR_TYPES + 1;
e < NB_UNPACK_TREES_WARNING_TYPES; e++) {
- struct string_list *rejects = &o->unpack_rejects[e];
+ struct string_list *rejects = &o->internal.unpack_rejects[e];
if (rejects->nr > 0) {
int i;
@@ -600,13 +604,14 @@ static void mark_ce_used(struct cache_entry *ce, struct unpack_trees_options *o)
{
ce->ce_flags |= CE_UNPACKED;
- if (o->cache_bottom < o->src_index->cache_nr &&
- o->src_index->cache[o->cache_bottom] == ce) {
- int bottom = o->cache_bottom;
+ if (o->internal.cache_bottom < o->src_index->cache_nr &&
+ o->src_index->cache[o->internal.cache_bottom] == ce) {
+ int bottom = o->internal.cache_bottom;
+
while (bottom < o->src_index->cache_nr &&
o->src_index->cache[bottom]->ce_flags & CE_UNPACKED)
bottom++;
- o->cache_bottom = bottom;
+ o->internal.cache_bottom = bottom;
}
}
@@ -652,7 +657,7 @@ static void mark_ce_used_same_name(struct cache_entry *ce,
static struct cache_entry *next_cache_entry(struct unpack_trees_options *o)
{
const struct index_state *index = o->src_index;
- int pos = o->cache_bottom;
+ int pos = o->internal.cache_bottom;
while (pos < index->cache_nr) {
struct cache_entry *ce = index->cache[pos];
@@ -711,7 +716,7 @@ static void restore_cache_bottom(struct traverse_info *info, int bottom)
if (o->diff_index_cached)
return;
- o->cache_bottom = bottom;
+ o->internal.cache_bottom = bottom;
}
static int switch_cache_bottom(struct traverse_info *info)
@@ -721,13 +726,13 @@ static int switch_cache_bottom(struct traverse_info *info)
if (o->diff_index_cached)
return 0;
- ret = o->cache_bottom;
+ ret = o->internal.cache_bottom;
pos = find_cache_pos(info->prev, info->name, info->namelen);
if (pos < -1)
- o->cache_bottom = -2 - pos;
+ o->internal.cache_bottom = -2 - pos;
else if (pos < 0)
- o->cache_bottom = o->src_index->cache_nr;
+ o->internal.cache_bottom = o->src_index->cache_nr;
return ret;
}
@@ -838,7 +843,7 @@ static int traverse_by_cache_tree(int pos, int nr_entries, int nr_names,
mark_ce_used(src[0], o);
}
free(tree_ce);
- if (o->debug_unpack)
+ if (o->internal.debug_unpack)
printf("Unpacked %d entries from %s to %s using cache-tree\n",
nr_entries,
o->src_index->cache[pos]->name,
@@ -873,9 +878,9 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
* save and restore cache_bottom anyway to not miss
* unprocessed entries before 'pos'.
*/
- bottom = o->cache_bottom;
+ bottom = o->internal.cache_bottom;
ret = traverse_by_cache_tree(pos, nr_entries, n, info);
- o->cache_bottom = bottom;
+ o->internal.cache_bottom = bottom;
return ret;
}
@@ -1212,8 +1217,8 @@ static int unpack_single_entry(int n, unsigned long mask,
* cache entry from the index aware logic.
*/
src[i + o->merge] = create_ce_entry(info, names + i, stage,
- &o->result, o->merge,
- bit & dirmask);
+ &o->internal.result,
+ o->merge, bit & dirmask);
}
if (o->merge) {
@@ -1237,7 +1242,7 @@ static int unpack_single_entry(int n, unsigned long mask,
static int unpack_failed(struct unpack_trees_options *o, const char *message)
{
- discard_index(&o->result);
+ discard_index(&o->internal.result);
if (!o->quiet && !o->exiting_early) {
if (message)
return error("%s", message);
@@ -1260,7 +1265,7 @@ static int find_cache_pos(struct traverse_info *info,
struct index_state *index = o->src_index;
int pfxlen = info->pathlen;
- for (pos = o->cache_bottom; pos < index->cache_nr; pos++) {
+ for (pos = o->internal.cache_bottom; pos < index->cache_nr; pos++) {
const struct cache_entry *ce = index->cache[pos];
const char *ce_name, *ce_slash;
int cmp, ce_len;
@@ -1271,8 +1276,8 @@ static int find_cache_pos(struct traverse_info *info,
* we can never match it; don't check it
* again.
*/
- if (pos == o->cache_bottom)
- ++o->cache_bottom;
+ if (pos == o->internal.cache_bottom)
+ ++o->internal.cache_bottom;
continue;
}
if (!ce_in_traverse_path(ce, info)) {
@@ -1450,7 +1455,7 @@ static int unpack_sparse_callback(int n, unsigned long mask, unsigned long dirma
*/
if (!is_null_oid(&names[0].oid)) {
src[0] = create_ce_entry(info, &names[0], 0,
- &o->result, 1,
+ &o->internal.result, 1,
dirmask & (1ul << 0));
src[0]->ce_flags |= (CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE);
}
@@ -1487,7 +1492,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
while (!p->mode)
p++;
- if (o->debug_unpack)
+ if (o->internal.debug_unpack)
debug_unpack_callback(n, mask, dirmask, names, info);
/* Are we supposed to look at the index too? */
@@ -1560,7 +1565,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
* in 'mark_ce_used()'
*/
if (!src[0] || !S_ISSPARSEDIR(src[0]->ce_mode))
- o->cache_bottom += matches;
+ o->internal.cache_bottom += matches;
return mask;
}
}
@@ -1809,7 +1814,7 @@ static void populate_from_existing_patterns(struct unpack_trees_options *o,
if (get_sparse_checkout_patterns(pl) < 0)
o->skip_sparse_checkout = 1;
else
- o->pl = pl;
+ o->internal.pl = pl;
}
static void update_sparsity_for_prefix(const char *prefix,
@@ -1871,8 +1876,12 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
if (len > MAX_UNPACK_TREES)
die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
- if (o->dir)
- BUG("o->dir is for internal use only");
+ if (o->internal.dir)
+ BUG("o->internal.dir is for internal use only");
+ if (o->internal.pl)
+ BUG("o->internal.pl is for internal use only");
+ if (o->df_conflict_entry)
+ BUG("o->df_conflict_entry is an output only field");
trace_performance_enter();
trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
@@ -1889,9 +1898,9 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
BUG("UNPACK_RESET_OVERWRITE_UNTRACKED incompatible with preserved ignored files");
if (!o->preserve_ignored) {
- o->dir = &dir;
- o->dir->flags |= DIR_SHOW_IGNORED;
- setup_standard_excludes(o->dir);
+ o->internal.dir = &dir;
+ o->internal.dir->flags |= DIR_SHOW_IGNORED;
+ setup_standard_excludes(o->internal.dir);
}
if (o->prefix)
@@ -1899,49 +1908,50 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
if (!core_apply_sparse_checkout || !o->update)
o->skip_sparse_checkout = 1;
- if (!o->skip_sparse_checkout && !o->pl) {
+ if (!o->skip_sparse_checkout) {
memset(&pl, 0, sizeof(pl));
free_pattern_list = 1;
populate_from_existing_patterns(o, &pl);
}
- index_state_init(&o->result, o->src_index->repo);
- o->result.initialized = 1;
- o->result.timestamp.sec = o->src_index->timestamp.sec;
- o->result.timestamp.nsec = o->src_index->timestamp.nsec;
- o->result.version = o->src_index->version;
+ index_state_init(&o->internal.result, o->src_index->repo);
+ o->internal.result.initialized = 1;
+ o->internal.result.timestamp.sec = o->src_index->timestamp.sec;
+ o->internal.result.timestamp.nsec = o->src_index->timestamp.nsec;
+ o->internal.result.version = o->src_index->version;
if (!o->src_index->split_index) {
- o->result.split_index = NULL;
+ o->internal.result.split_index = NULL;
} else if (o->src_index == o->dst_index) {
/*
* o->dst_index (and thus o->src_index) will be discarded
- * and overwritten with o->result at the end of this function,
- * so just use src_index's split_index to avoid having to
- * create a new one.
+ * and overwritten with o->internal.result at the end of
+ * this function, so just use src_index's split_index to
+ * avoid having to create a new one.
*/
- o->result.split_index = o->src_index->split_index;
- o->result.split_index->refcount++;
+ o->internal.result.split_index = o->src_index->split_index;
+ o->internal.result.split_index->refcount++;
} else {
- o->result.split_index = init_split_index(&o->result);
+ o->internal.result.split_index =
+ init_split_index(&o->internal.result);
}
- oidcpy(&o->result.oid, &o->src_index->oid);
- o->merge_size = len;
+ oidcpy(&o->internal.result.oid, &o->src_index->oid);
+ o->internal.merge_size = len;
mark_all_ce_unused(o->src_index);
- o->result.fsmonitor_last_update =
+ o->internal.result.fsmonitor_last_update =
xstrdup_or_null(o->src_index->fsmonitor_last_update);
- o->result.fsmonitor_has_run_once = o->src_index->fsmonitor_has_run_once;
+ o->internal.result.fsmonitor_has_run_once = o->src_index->fsmonitor_has_run_once;
if (!o->src_index->initialized &&
!repo->settings.command_requires_full_index &&
- is_sparse_index_allowed(&o->result, 0))
- o->result.sparse_index = 1;
+ is_sparse_index_allowed(&o->internal.result, 0))
+ o->internal.result.sparse_index = 1;
/*
* Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries
*/
if (!o->skip_sparse_checkout)
- mark_new_skip_worktree(o->pl, o->src_index, 0,
+ mark_new_skip_worktree(o->internal.pl, o->src_index, 0,
CE_NEW_SKIP_WORKTREE, o->verbose_update);
if (!dfc)
@@ -1955,7 +1965,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
setup_traverse_info(&info, prefix);
info.fn = unpack_callback;
info.data = o;
- info.show_all_errors = o->show_all_errors;
+ info.show_all_errors = o->internal.show_all_errors;
info.pathspec = o->pathspec;
if (o->prefix) {
@@ -1996,7 +2006,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
}
mark_all_ce_unused(o->src_index);
- if (o->trivial_merges_only && o->nontrivial_merge) {
+ if (o->trivial_merges_only && o->internal.nontrivial_merge) {
ret = unpack_failed(o, "Merge requires file-level merging");
goto done;
}
@@ -2007,13 +2017,13 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
* If they will have NEW_SKIP_WORKTREE, also set CE_SKIP_WORKTREE
* so apply_sparse_checkout() won't attempt to remove it from worktree
*/
- mark_new_skip_worktree(o->pl, &o->result,
+ mark_new_skip_worktree(o->internal.pl, &o->internal.result,
CE_ADDED, CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE,
o->verbose_update);
ret = 0;
- for (i = 0; i < o->result.cache_nr; i++) {
- struct cache_entry *ce = o->result.cache[i];
+ for (i = 0; i < o->internal.result.cache_nr; i++) {
+ struct cache_entry *ce = o->internal.result.cache[i];
/*
* Entries marked with CE_ADDED in merged_entry() do not have
@@ -2027,7 +2037,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
verify_absent(ce, WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN, o))
ret = 1;
- if (apply_sparse_checkout(&o->result, ce, o))
+ if (apply_sparse_checkout(&o->internal.result, ce, o))
ret = 1;
}
if (ret == 1) {
@@ -2035,46 +2045,47 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
* Inability to sparsify or de-sparsify individual
* paths is not an error, but just a warning.
*/
- if (o->show_all_errors)
+ if (o->internal.show_all_errors)
display_warning_msgs(o);
ret = 0;
}
}
- ret = check_updates(o, &o->result) ? (-2) : 0;
+ ret = check_updates(o, &o->internal.result) ? (-2) : 0;
if (o->dst_index) {
- move_index_extensions(&o->result, o->src_index);
+ move_index_extensions(&o->internal.result, o->src_index);
if (!ret) {
if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0))
- cache_tree_verify(the_repository, &o->result);
+ cache_tree_verify(the_repository,
+ &o->internal.result);
if (!o->skip_cache_tree_update &&
- !cache_tree_fully_valid(o->result.cache_tree))
- cache_tree_update(&o->result,
+ !cache_tree_fully_valid(o->internal.result.cache_tree))
+ cache_tree_update(&o->internal.result,
WRITE_TREE_SILENT |
WRITE_TREE_REPAIR);
}
- o->result.updated_workdir = 1;
+ o->internal.result.updated_workdir = 1;
discard_index(o->dst_index);
- *o->dst_index = o->result;
+ *o->dst_index = o->internal.result;
} else {
- discard_index(&o->result);
+ discard_index(&o->internal.result);
}
o->src_index = NULL;
done:
if (free_pattern_list)
clear_pattern_list(&pl);
- if (o->dir) {
- dir_clear(o->dir);
- o->dir = NULL;
+ if (o->internal.dir) {
+ dir_clear(o->internal.dir);
+ o->internal.dir = NULL;
}
trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
trace_performance_leave("unpack_trees");
return ret;
return_failed:
- if (o->show_all_errors)
+ if (o->internal.show_all_errors)
display_error_msgs(o);
mark_all_ce_unused(o->src_index);
ret = unpack_failed(o, NULL);
@@ -2089,16 +2100,17 @@ return_failed:
*
* CE_NEW_SKIP_WORKTREE is used internally.
*/
-enum update_sparsity_result update_sparsity(struct unpack_trees_options *o)
+enum update_sparsity_result update_sparsity(struct unpack_trees_options *o,
+ struct pattern_list *pl)
{
enum update_sparsity_result ret = UPDATE_SPARSITY_SUCCESS;
- struct pattern_list pl;
int i;
unsigned old_show_all_errors;
int free_pattern_list = 0;
- old_show_all_errors = o->show_all_errors;
- o->show_all_errors = 1;
+ old_show_all_errors = o->internal.show_all_errors;
+ o->internal.show_all_errors = 1;
+ index_state_init(&o->internal.result, o->src_index->repo);
/* Sanity checks */
if (!o->update || o->index_only || o->skip_sparse_checkout)
@@ -2109,20 +2121,19 @@ enum update_sparsity_result update_sparsity(struct unpack_trees_options *o)
trace_performance_enter();
/* If we weren't given patterns, use the recorded ones */
- if (!o->pl) {
- memset(&pl, 0, sizeof(pl));
+ if (!pl) {
free_pattern_list = 1;
- populate_from_existing_patterns(o, &pl);
- if (o->skip_sparse_checkout)
- goto skip_sparse_checkout;
+ pl = xcalloc(1, sizeof(*pl));
+ populate_from_existing_patterns(o, pl);
}
+ o->internal.pl = pl;
/* Expand sparse directories as needed */
- expand_index(o->src_index, o->pl);
+ expand_index(o->src_index, o->internal.pl);
/* Set NEW_SKIP_WORKTREE on existing entries. */
mark_all_ce_unused(o->src_index);
- mark_new_skip_worktree(o->pl, o->src_index, 0,
+ mark_new_skip_worktree(o->internal.pl, o->src_index, 0,
CE_NEW_SKIP_WORKTREE, o->verbose_update);
/* Then loop over entries and update/remove as needed */
@@ -2142,14 +2153,16 @@ enum update_sparsity_result update_sparsity(struct unpack_trees_options *o)
ret = UPDATE_SPARSITY_WARNINGS;
}
-skip_sparse_checkout:
if (check_updates(o, o->src_index))
ret = UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES;
display_warning_msgs(o);
- o->show_all_errors = old_show_all_errors;
- if (free_pattern_list)
- clear_pattern_list(&pl);
+ o->internal.show_all_errors = old_show_all_errors;
+ if (free_pattern_list) {
+ clear_pattern_list(pl);
+ free(pl);
+ o->internal.pl = NULL;
+ }
trace_performance_leave("update_sparsity");
return ret;
}
@@ -2244,15 +2257,15 @@ static int verify_uptodate_sparse(const struct cache_entry *ce,
}
/*
- * TODO: We should actually invalidate o->result, not src_index [1].
+ * TODO: We should actually invalidate o->internal.result, not src_index [1].
* But since cache tree and untracked cache both are not copied to
- * o->result until unpacking is complete, we invalidate them on
+ * o->internal.result until unpacking is complete, we invalidate them on
* src_index instead with the assumption that they will be copied to
* dst_index at the end.
*
* [1] src_index->cache_tree is also used in unpack_callback() so if
- * we invalidate o->result, we need to update it to use
- * o->result.cache_tree as well.
+ * we invalidate o->internal.result, we need to update it to use
+ * o->internal.result.cache_tree as well.
*/
static void invalidate_ce_path(const struct cache_entry *ce,
struct unpack_trees_options *o)
@@ -2336,8 +2349,8 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
pathbuf = xstrfmt("%.*s/", namelen, ce->name);
memset(&d, 0, sizeof(d));
- if (o->dir)
- d.exclude_per_dir = o->dir->exclude_per_dir;
+ if (o->internal.dir)
+ setup_standard_excludes(&d);
i = read_directory(&d, o->src_index, pathbuf, namelen+1, NULL);
dir_clear(&d);
free(pathbuf);
@@ -2391,8 +2404,8 @@ static int check_ok_to_remove(const char *name, int len, int dtype,
if (ignore_case && icase_exists(o, name, len, st))
return 0;
- if (o->dir &&
- is_excluded(o->dir, o->src_index, name, &dtype))
+ if (o->internal.dir &&
+ is_excluded(o->internal.dir, o->src_index, name, &dtype))
/*
* ce->name is explicitly excluded, so it is Ok to
* overwrite it.
@@ -2420,7 +2433,7 @@ static int check_ok_to_remove(const char *name, int len, int dtype,
* delete this path, which is in a subdirectory that
* is being replaced with a blob.
*/
- result = index_file_exists(&o->result, name, len, 0);
+ result = index_file_exists(&o->internal.result, name, len, 0);
if (result) {
if (result->ce_flags & CE_REMOVE)
return 0;
@@ -2521,7 +2534,7 @@ static int merged_entry(const struct cache_entry *ce,
struct unpack_trees_options *o)
{
int update = CE_UPDATE;
- struct cache_entry *merge = dup_cache_entry(ce, &o->result);
+ struct cache_entry *merge = dup_cache_entry(ce, &o->internal.result);
if (!old) {
/*
@@ -2616,7 +2629,7 @@ static int merged_sparse_dir(const struct cache_entry * const *src, int n,
setup_traverse_info(&info, src[0]->name);
info.fn = unpack_sparse_callback;
info.data = o;
- info.show_all_errors = o->show_all_errors;
+ info.show_all_errors = o->internal.show_all_errors;
info.pathspec = o->pathspec;
/* Get the tree descriptors of the sparse directory in each of the merging trees */
@@ -2834,7 +2847,7 @@ int threeway_merge(const struct cache_entry * const *stages,
return -1;
}
- o->nontrivial_merge = 1;
+ o->internal.nontrivial_merge = 1;
/* #2, #3, #4, #6, #7, #9, #10, #11. */
count = 0;
@@ -2875,9 +2888,9 @@ int twoway_merge(const struct cache_entry * const *src,
const struct cache_entry *oldtree = src[1];
const struct cache_entry *newtree = src[2];
- if (o->merge_size != 2)
+ if (o->internal.merge_size != 2)
return error("Cannot do a twoway merge of %d trees",
- o->merge_size);
+ o->internal.merge_size);
if (oldtree == o->df_conflict_entry)
oldtree = NULL;
@@ -2957,9 +2970,9 @@ int bind_merge(const struct cache_entry * const *src,
const struct cache_entry *old = src[0];
const struct cache_entry *a = src[1];
- if (o->merge_size != 1)
+ if (o->internal.merge_size != 1)
return error("Cannot do a bind merge of %d trees",
- o->merge_size);
+ o->internal.merge_size);
if (a && old)
return o->quiet ? -1 :
error(ERRORMSG(o, ERROR_BIND_OVERLAP),
@@ -2983,9 +2996,9 @@ int oneway_merge(const struct cache_entry * const *src,
const struct cache_entry *old = src[0];
const struct cache_entry *a = src[1];
- if (o->merge_size != 1)
+ if (o->internal.merge_size != 1)
return error("Cannot do a oneway merge of %d trees",
- o->merge_size);
+ o->internal.merge_size);
if (!a || a == o->df_conflict_entry)
return deleted_entry(old, old, o);
@@ -3020,8 +3033,8 @@ int stash_worktree_untracked_merge(const struct cache_entry * const *src,
const struct cache_entry *worktree = src[1];
const struct cache_entry *untracked = src[2];
- if (o->merge_size != 2)
- BUG("invalid merge_size: %d", o->merge_size);
+ if (o->internal.merge_size != 2)
+ BUG("invalid merge_size: %d", o->internal.merge_size);
if (worktree && untracked)
return error(_("worktree and untracked commit have duplicate entries: %s"),