| 864 | } |
| 865 | |
| 866 | static int traverse_trees_recursive(int n, unsigned long dirmask, |
| 867 | unsigned long df_conflicts, |
| 868 | struct name_entry *names, |
| 869 | struct traverse_info *info) |
| 870 | { |
| 871 | struct unpack_trees_options *o = info->data; |
| 872 | int i, ret, bottom; |
| 873 | int nr_buf = 0; |
| 874 | struct tree_desc *t; |
| 875 | void **buf; |
| 876 | struct traverse_info newinfo; |
| 877 | struct name_entry *p; |
| 878 | int nr_entries; |
| 879 | |
| 880 | nr_entries = all_trees_same_as_cache_tree(n, dirmask, names, info); |
| 881 | if (nr_entries > 0) { |
| 882 | int pos = index_pos_by_traverse_info(names, info); |
| 883 | |
| 884 | if (!o->merge || df_conflicts) |
| 885 | BUG("Wrong condition to get here buddy"); |
| 886 | |
| 887 | /* |
| 888 | * All entries up to 'pos' must have been processed |
| 889 | * (i.e. marked CE_UNPACKED) at this point. But to be safe, |
| 890 | * save and restore cache_bottom anyway to not miss |
| 891 | * unprocessed entries before 'pos'. |
| 892 | */ |
| 893 | bottom = o->internal.cache_bottom; |
| 894 | ret = traverse_by_cache_tree(pos, nr_entries, n, info); |
| 895 | o->internal.cache_bottom = bottom; |
| 896 | return ret; |
| 897 | } |
| 898 | |
| 899 | p = names; |
| 900 | while (!p->mode) |
| 901 | p++; |
| 902 | |
| 903 | newinfo = *info; |
| 904 | newinfo.prev = info; |
| 905 | newinfo.pathspec = info->pathspec; |
| 906 | newinfo.name = p->path; |
| 907 | newinfo.namelen = p->pathlen; |
| 908 | newinfo.mode = p->mode; |
| 909 | newinfo.pathlen = st_add3(newinfo.pathlen, tree_entry_len(p), 1); |
| 910 | newinfo.df_conflicts |= df_conflicts; |
| 911 | |
| 912 | ALLOC_ARRAY(t, n); |
| 913 | ALLOC_ARRAY(buf, n); |
| 914 | |
| 915 | /* |
| 916 | * Fetch the tree from the ODB for each peer directory in the |
| 917 | * n commits. |
| 918 | * |
| 919 | * For 2- and 3-way traversals, we try to avoid hitting the |
| 920 | * ODB twice for the same OID. This should yield a nice speed |
| 921 | * up in checkouts and merges when the commits are similar. |
| 922 | * |
| 923 | * We don't bother doing the full O(n^2) search for larger n, |
no test coverage detected