MCPcopy Create free account
hub / github.com/git/git / traverse_trees_wrapper

Function traverse_trees_wrapper

merge-ort.c:985–1023  ·  view source on GitHub ↗

* Much like traverse_trees(), BUT: * - read all the tree entries FIRST, saving them * - note that the above step provides an opportunity to compute necessary * additional details before the "real" traversal * - loop through the saved entries and call the original callback on them */

Source from the content-addressed store, hash-verified

983 * - loop through the saved entries and call the original callback on them
984 */
985static int traverse_trees_wrapper(struct index_state *istate,
986 int n,
987 struct tree_desc *t,
988 struct traverse_info *info)
989{
990 int ret, i, old_offset;
991 traverse_callback_t old_fn;
992 char *old_callback_data_traverse_path;
993 struct merge_options *opt = info->data;
994 struct rename_info *renames = &opt->priv->renames;
995
996 assert(renames->dir_rename_mask == 2 || renames->dir_rename_mask == 4);
997
998 old_callback_data_traverse_path = renames->callback_data_traverse_path;
999 old_fn = info->fn;
1000 old_offset = renames->callback_data_nr;
1001
1002 renames->callback_data_traverse_path = NULL;
1003 info->fn = traverse_trees_wrapper_callback;
1004 ret = traverse_trees(istate, n, t, info);
1005 if (ret < 0)
1006 return ret;
1007
1008 info->traverse_path = renames->callback_data_traverse_path;
1009 info->fn = old_fn;
1010 for (i = old_offset; i < renames->callback_data_nr; ++i) {
1011 info->fn(n,
1012 renames->callback_data[i].mask,
1013 renames->callback_data[i].dirmask,
1014 renames->callback_data[i].names,
1015 info);
1016 }
1017
1018 renames->callback_data_nr = old_offset;
1019 free(renames->callback_data_traverse_path);
1020 renames->callback_data_traverse_path = old_callback_data_traverse_path;
1021 info->traverse_path = NULL;
1022 return 0;
1023}
1024
1025static void setup_path_info(struct merge_options *opt,
1026 struct string_list_item *result,

Callers 2

handle_deferred_entriesFunction · 0.85

Calls 1

traverse_treesFunction · 0.85

Tested by

no test coverage detected