| 147 | } |
| 148 | |
| 149 | static void process_tree(struct traversal_context *ctx, |
| 150 | struct tree *tree, |
| 151 | struct strbuf *base, |
| 152 | const char *name) |
| 153 | { |
| 154 | struct object *obj = &tree->object; |
| 155 | struct rev_info *revs = ctx->revs; |
| 156 | int baselen = base->len; |
| 157 | enum list_objects_filter_result r; |
| 158 | int failed_parse; |
| 159 | |
| 160 | if (!revs->tree_objects) |
| 161 | return; |
| 162 | if (!obj) |
| 163 | die("bad tree object"); |
| 164 | if (obj->flags & (UNINTERESTING | SEEN)) |
| 165 | return; |
| 166 | if (revs->include_check_obj && |
| 167 | !revs->include_check_obj(&tree->object, revs->include_check_data)) |
| 168 | return; |
| 169 | |
| 170 | if (ctx->depth > revs->repo->settings.max_allowed_tree_depth) |
| 171 | die("exceeded maximum allowed tree depth"); |
| 172 | |
| 173 | failed_parse = repo_parse_tree_gently(the_repository, tree, 1); |
| 174 | if (failed_parse) { |
| 175 | if (revs->ignore_missing_links) |
| 176 | return; |
| 177 | |
| 178 | /* |
| 179 | * Pre-filter known-missing tree objects when explicitly |
| 180 | * requested. This may cause the actual filter to report |
| 181 | * an incomplete list of missing objects. |
| 182 | */ |
| 183 | if (revs->exclude_promisor_objects && |
| 184 | is_promisor_object(revs->repo, &obj->oid)) |
| 185 | return; |
| 186 | |
| 187 | if (!revs->do_not_die_on_missing_objects) |
| 188 | die("bad tree object %s", oid_to_hex(&obj->oid)); |
| 189 | } |
| 190 | |
| 191 | strbuf_addstr(base, name); |
| 192 | r = list_objects_filter__filter_object(ctx->revs->repo, |
| 193 | LOFS_BEGIN_TREE, obj, |
| 194 | base->buf, &base->buf[baselen], |
| 195 | ctx->filter); |
| 196 | if (r & LOFR_MARK_SEEN) |
| 197 | obj->flags |= SEEN; |
| 198 | if (r & LOFR_DO_SHOW) |
| 199 | show_object(ctx, obj, base->buf); |
| 200 | if (base->len) |
| 201 | strbuf_addch(base, '/'); |
| 202 | |
| 203 | if (r & LOFR_SKIP_TREE) |
| 204 | trace_printf("Skipping contents of tree %s...\n", base->buf); |
| 205 | else if (!failed_parse) |
| 206 | process_tree_contents(ctx, tree, base); |
no test coverage detected