blob: b5651ddd5bfdd6cda4047f71cc3cb66fc31a793d [file] [log] [blame]
Junio C Hamanoc64ed702006-09-04 21:50:12 -07001#include "cache.h"
2#include "tag.h"
3#include "commit.h"
4#include "tree.h"
5#include "blob.h"
6#include "diff.h"
7#include "tree-walk.h"
8#include "revision.h"
9#include "list-objects.h"
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +000010#include "list-objects-filter.h"
11#include "list-objects-filter-options.h"
Jonathan Tandf11e192017-12-08 15:27:15 +000012#include "packfile.h"
Stefan Bellercbd53a22018-05-15 16:42:15 -070013#include "object-store.h"
Matthew DeVore8b10a202018-10-17 17:39:15 -070014#include "trace.h"
Junio C Hamanoc64ed702006-09-04 21:50:12 -070015
Matthew DeVoref447a492018-08-13 11:14:28 -070016struct traversal_context {
17 struct rev_info *revs;
18 show_object_fn show_object;
19 show_commit_fn show_commit;
20 void *show_data;
21 filter_object_fn filter_fn;
22 void *filter_data;
23};
24
25static void process_blob(struct traversal_context *ctx,
Junio C Hamanoc64ed702006-09-04 21:50:12 -070026 struct blob *blob,
Jeff Kingbd645162016-02-11 17:26:44 -050027 struct strbuf *path,
Matthew DeVoref447a492018-08-13 11:14:28 -070028 const char *name)
Junio C Hamanoc64ed702006-09-04 21:50:12 -070029{
30 struct object *obj = &blob->object;
Jeff Kingde1e67d2016-02-11 17:28:36 -050031 size_t pathlen;
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +000032 enum list_objects_filter_result r = LOFR_MARK_SEEN | LOFR_DO_SHOW;
Junio C Hamanoc64ed702006-09-04 21:50:12 -070033
Matthew DeVoref447a492018-08-13 11:14:28 -070034 if (!ctx->revs->blob_objects)
Junio C Hamanoc64ed702006-09-04 21:50:12 -070035 return;
Martin Koeglera301b0c2008-02-18 21:47:56 +010036 if (!obj)
37 die("bad blob object");
Junio C Hamanoc64ed702006-09-04 21:50:12 -070038 if (obj->flags & (UNINTERESTING | SEEN))
39 return;
Jeff Kingde1e67d2016-02-11 17:28:36 -050040
Jonathan Tandf11e192017-12-08 15:27:15 +000041 /*
42 * Pre-filter known-missing objects when explicitly requested.
43 * Otherwise, a missing object error message may be reported
44 * later (depending on other filtering criteria).
45 *
46 * Note that this "--exclude-promisor-objects" pre-filtering
47 * may cause the actual filter to report an incomplete list
48 * of missing objects.
49 */
Matthew DeVoref447a492018-08-13 11:14:28 -070050 if (ctx->revs->exclude_promisor_objects &&
Jonathan Tandf11e192017-12-08 15:27:15 +000051 !has_object_file(&obj->oid) &&
52 is_promisor_object(&obj->oid))
53 return;
54
Jeff Kingde1e67d2016-02-11 17:28:36 -050055 pathlen = path->len;
56 strbuf_addstr(path, name);
Matthew DeVore99c9aa92018-10-05 14:31:24 -070057 if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
Nguyễn Thái Ngọc Duy01d40c82018-11-10 06:48:51 +010058 r = ctx->filter_fn(ctx->revs->repo,
59 LOFS_BLOB, obj,
Matthew DeVoref447a492018-08-13 11:14:28 -070060 path->buf, &path->buf[pathlen],
61 ctx->filter_data);
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +000062 if (r & LOFR_MARK_SEEN)
63 obj->flags |= SEEN;
64 if (r & LOFR_DO_SHOW)
Matthew DeVoref447a492018-08-13 11:14:28 -070065 ctx->show_object(obj, path->buf, ctx->show_data);
Jeff Kingde1e67d2016-02-11 17:28:36 -050066 strbuf_setlen(path, pathlen);
Junio C Hamanoc64ed702006-09-04 21:50:12 -070067}
68
Linus Torvalds6e2f4412007-04-13 09:25:01 -070069/*
70 * Processing a gitlink entry currently does nothing, since
71 * we do not recurse into the subproject.
72 *
73 * We *could* eventually add a flag that actually does that,
74 * which would involve:
75 * - is the subproject actually checked out?
76 * - if so, see if the subproject has already been added
77 * to the alternates list, and add it if not.
78 * - process the commit (or tag) the gitlink points to
79 * recursively.
80 *
81 * However, it's unclear whether there is really ever any
82 * reason to see superprojects and subprojects as such a
83 * "unified" object pool (potentially resulting in a totally
84 * humongous pack - avoiding which was the whole point of
85 * having gitlinks in the first place!).
86 *
87 * So for now, there is just a note that we *could* follow
88 * the link, and how to do it. Whether it necessarily makes
89 * any sense what-so-ever to ever do that is another issue.
90 */
Matthew DeVoref447a492018-08-13 11:14:28 -070091static void process_gitlink(struct traversal_context *ctx,
Linus Torvalds6e2f4412007-04-13 09:25:01 -070092 const unsigned char *sha1,
Jeff Kingbd645162016-02-11 17:26:44 -050093 struct strbuf *path,
Matthew DeVoref447a492018-08-13 11:14:28 -070094 const char *name)
Linus Torvalds6e2f4412007-04-13 09:25:01 -070095{
96 /* Nothing to do */
97}
98
Matthew DeVoref447a492018-08-13 11:14:28 -070099static void process_tree(struct traversal_context *ctx,
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700100 struct tree *tree,
Elijah Newrencc5fa2f2010-12-17 20:26:47 +0700101 struct strbuf *base,
Matthew DeVore92024892018-08-13 11:14:29 -0700102 const char *name);
103
104static void process_tree_contents(struct traversal_context *ctx,
105 struct tree *tree,
106 struct strbuf *base)
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700107{
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700108 struct tree_desc desc;
109 struct name_entry entry;
Matthew DeVore92024892018-08-13 11:14:29 -0700110 enum interesting match = ctx->revs->diffopt.pathspec.nr == 0 ?
111 all_entries_interesting : entry_not_interesting;
112
113 init_tree_desc(&desc, tree->buffer, tree->size);
114
115 while (tree_entry(&desc, &entry)) {
116 if (match != all_entries_interesting) {
Nguyễn Thái Ngọc Duy67022e02018-11-18 17:47:57 +0100117 match = tree_entry_interesting(ctx->revs->repo->index,
118 &entry, base, 0,
Matthew DeVore92024892018-08-13 11:14:29 -0700119 &ctx->revs->diffopt.pathspec);
120 if (match == all_entries_not_interesting)
121 break;
122 if (match == entry_not_interesting)
123 continue;
124 }
125
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700126 if (S_ISDIR(entry.mode)) {
brian m. carlsonea82b2a2019-01-15 00:39:44 +0000127 struct tree *t = lookup_tree(ctx->revs->repo, &entry.oid);
Taylor Blaub49e74e2019-04-09 19:13:19 -0700128 if (!t) {
129 die(_("entry '%s' in tree %s has tree mode, "
130 "but is not a tree"),
131 entry.path, oid_to_hex(&tree->object.oid));
132 }
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700133 t->object.flags |= NOT_USER_GIVEN;
134 process_tree(ctx, t, base, entry.path);
135 }
Matthew DeVore92024892018-08-13 11:14:29 -0700136 else if (S_ISGITLINK(entry.mode))
brian m. carlsonea82b2a2019-01-15 00:39:44 +0000137 process_gitlink(ctx, entry.oid.hash,
Matthew DeVore92024892018-08-13 11:14:29 -0700138 base, entry.path);
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700139 else {
brian m. carlsonea82b2a2019-01-15 00:39:44 +0000140 struct blob *b = lookup_blob(ctx->revs->repo, &entry.oid);
Taylor Blau23c20442019-04-09 19:13:17 -0700141 if (!b) {
142 die(_("entry '%s' in tree %s has blob mode, "
143 "but is not a blob"),
144 entry.path, oid_to_hex(&tree->object.oid));
145 }
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700146 b->object.flags |= NOT_USER_GIVEN;
147 process_blob(ctx, b, base, entry.path);
148 }
Matthew DeVore92024892018-08-13 11:14:29 -0700149 }
150}
151
152static void process_tree(struct traversal_context *ctx,
153 struct tree *tree,
154 struct strbuf *base,
Matthew DeVoref447a492018-08-13 11:14:28 -0700155 const char *name)
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700156{
157 struct object *obj = &tree->object;
Matthew DeVoref447a492018-08-13 11:14:28 -0700158 struct rev_info *revs = ctx->revs;
Elijah Newrencc5fa2f2010-12-17 20:26:47 +0700159 int baselen = base->len;
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000160 enum list_objects_filter_result r = LOFR_MARK_SEEN | LOFR_DO_SHOW;
Matthew DeVore7c0fe332018-10-05 14:31:23 -0700161 int failed_parse;
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700162
163 if (!revs->tree_objects)
164 return;
Martin Koeglera301b0c2008-02-18 21:47:56 +0100165 if (!obj)
166 die("bad tree object");
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700167 if (obj->flags & (UNINTERESTING | SEEN))
168 return;
Matthew DeVore7c0fe332018-10-05 14:31:23 -0700169
170 failed_parse = parse_tree_gently(tree, 1);
171 if (failed_parse) {
Vicent Marti2db1a432014-03-28 06:00:43 -0400172 if (revs->ignore_missing_links)
173 return;
Jonathan Tandf11e192017-12-08 15:27:15 +0000174
175 /*
176 * Pre-filter known-missing tree objects when explicitly
177 * requested. This may cause the actual filter to report
178 * an incomplete list of missing objects.
179 */
180 if (revs->exclude_promisor_objects &&
181 is_promisor_object(&obj->oid))
182 return;
183
Matthew DeVore7c0fe332018-10-05 14:31:23 -0700184 if (!revs->do_not_die_on_missing_tree)
185 die("bad tree object %s", oid_to_hex(&obj->oid));
Vicent Marti2db1a432014-03-28 06:00:43 -0400186 }
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700187
Jeff King13528ab2016-02-11 17:26:18 -0500188 strbuf_addstr(base, name);
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700189 if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
Nguyễn Thái Ngọc Duy01d40c82018-11-10 06:48:51 +0100190 r = ctx->filter_fn(ctx->revs->repo,
191 LOFS_BEGIN_TREE, obj,
Matthew DeVoref447a492018-08-13 11:14:28 -0700192 base->buf, &base->buf[baselen],
193 ctx->filter_data);
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000194 if (r & LOFR_MARK_SEEN)
195 obj->flags |= SEEN;
196 if (r & LOFR_DO_SHOW)
Matthew DeVoref447a492018-08-13 11:14:28 -0700197 ctx->show_object(obj, base->buf, ctx->show_data);
Jeff King13528ab2016-02-11 17:26:18 -0500198 if (base->len)
199 strbuf_addch(base, '/');
Elijah Newrencc5fa2f2010-12-17 20:26:47 +0700200
Matthew DeVore8b10a202018-10-17 17:39:15 -0700201 if (r & LOFR_SKIP_TREE)
202 trace_printf("Skipping contents of tree %s...\n", base->buf);
203 else if (!failed_parse)
Matthew DeVore7c0fe332018-10-05 14:31:23 -0700204 process_tree_contents(ctx, tree, base);
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700205
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700206 if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn) {
Nguyễn Thái Ngọc Duy01d40c82018-11-10 06:48:51 +0100207 r = ctx->filter_fn(ctx->revs->repo,
208 LOFS_END_TREE, obj,
Matthew DeVoref447a492018-08-13 11:14:28 -0700209 base->buf, &base->buf[baselen],
210 ctx->filter_data);
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000211 if (r & LOFR_MARK_SEEN)
212 obj->flags |= SEEN;
213 if (r & LOFR_DO_SHOW)
Matthew DeVoref447a492018-08-13 11:14:28 -0700214 ctx->show_object(obj, base->buf, ctx->show_data);
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000215 }
216
Elijah Newrencc5fa2f2010-12-17 20:26:47 +0700217 strbuf_setlen(base, baselen);
Jeff King6e454b92013-06-05 18:37:39 -0400218 free_tree_buffer(tree);
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700219}
220
Junio C Hamano8d1d8f82006-09-06 01:42:23 -0700221static void mark_edge_parents_uninteresting(struct commit *commit,
222 struct rev_info *revs,
223 show_edge_fn show_edge)
224{
225 struct commit_list *parents;
226
227 for (parents = commit->parents; parents; parents = parents->next) {
228 struct commit *parent = parents->item;
229 if (!(parent->object.flags & UNINTERESTING))
230 continue;
Nguyễn Thái Ngọc Duyb3c7eef2018-09-21 17:57:39 +0200231 mark_tree_uninteresting(revs->repo, get_commit_tree(parent));
Junio C Hamano8d1d8f82006-09-06 01:42:23 -0700232 if (revs->edge_hint && !(parent->object.flags & SHOWN)) {
233 parent->object.flags |= SHOWN;
234 show_edge(parent);
235 }
236 }
237}
238
Derrick Stolee4f6d26b2019-01-16 10:25:58 -0800239static void add_edge_parents(struct commit *commit,
240 struct rev_info *revs,
241 show_edge_fn show_edge,
242 struct oidset *set)
243{
244 struct commit_list *parents;
245
246 for (parents = commit->parents; parents; parents = parents->next) {
247 struct commit *parent = parents->item;
248 struct tree *tree = get_commit_tree(parent);
249
250 if (!tree)
251 continue;
252
253 oidset_insert(set, &tree->object.oid);
254
255 if (!(parent->object.flags & UNINTERESTING))
256 continue;
257 tree->object.flags |= UNINTERESTING;
258
259 if (revs->edge_hint && !(parent->object.flags & SHOWN)) {
260 parent->object.flags |= SHOWN;
261 show_edge(parent);
262 }
263 }
264}
265
266void mark_edges_uninteresting(struct rev_info *revs,
267 show_edge_fn show_edge,
268 int sparse)
Junio C Hamano8d1d8f82006-09-06 01:42:23 -0700269{
Nguyễn Thái Ngọc Duye76a5fb2013-08-16 16:52:06 +0700270 struct commit_list *list;
Nguyễn Thái Ngọc Duyfbd4a702013-08-16 16:52:07 +0700271 int i;
272
Derrick Stolee4f6d26b2019-01-16 10:25:58 -0800273 if (sparse) {
274 struct oidset set;
275 oidset_init(&set, 16);
Junio C Hamano8d1d8f82006-09-06 01:42:23 -0700276
Derrick Stolee4f6d26b2019-01-16 10:25:58 -0800277 for (list = revs->commits; list; list = list->next) {
278 struct commit *commit = list->item;
279 struct tree *tree = get_commit_tree(commit);
280
281 if (commit->object.flags & UNINTERESTING)
282 tree->object.flags |= UNINTERESTING;
283
284 oidset_insert(&set, &tree->object.oid);
285 add_edge_parents(commit, revs, show_edge, &set);
Junio C Hamano8d1d8f82006-09-06 01:42:23 -0700286 }
Derrick Stolee4f6d26b2019-01-16 10:25:58 -0800287
288 mark_trees_uninteresting_sparse(revs->repo, &set);
289 oidset_clear(&set);
290 } else {
291 for (list = revs->commits; list; list = list->next) {
292 struct commit *commit = list->item;
293 if (commit->object.flags & UNINTERESTING) {
294 mark_tree_uninteresting(revs->repo,
295 get_commit_tree(commit));
296 if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
297 commit->object.flags |= SHOWN;
298 show_edge(commit);
299 }
300 continue;
301 }
302 mark_edge_parents_uninteresting(commit, revs, show_edge);
303 }
Junio C Hamano8d1d8f82006-09-06 01:42:23 -0700304 }
Derrick Stolee4f6d26b2019-01-16 10:25:58 -0800305
brian m. carlson1684c1b2014-12-24 23:05:39 +0000306 if (revs->edge_hint_aggressive) {
Jeff King200abe72014-01-20 21:25:40 -0500307 for (i = 0; i < revs->cmdline.nr; i++) {
308 struct object *obj = revs->cmdline.rev[i].item;
309 struct commit *commit = (struct commit *)obj;
310 if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
311 continue;
Nguyễn Thái Ngọc Duyb3c7eef2018-09-21 17:57:39 +0200312 mark_tree_uninteresting(revs->repo,
313 get_commit_tree(commit));
Jeff King200abe72014-01-20 21:25:40 -0500314 if (!(obj->flags & SHOWN)) {
315 obj->flags |= SHOWN;
316 show_edge(commit);
317 }
Nguyễn Thái Ngọc Duyfbd4a702013-08-16 16:52:07 +0700318 }
319 }
Junio C Hamano8d1d8f82006-09-06 01:42:23 -0700320}
321
Linus Torvalds8d2dfc42009-04-10 17:27:58 -0700322static void add_pending_tree(struct rev_info *revs, struct tree *tree)
323{
324 add_pending_object(revs, &tree->object, "");
325}
326
Matthew DeVoref447a492018-08-13 11:14:28 -0700327static void traverse_trees_and_blobs(struct traversal_context *ctx,
328 struct strbuf *base)
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700329{
330 int i;
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700331
Stefan Beller91904f52017-11-02 12:41:43 -0700332 assert(base->len == 0);
333
Matthew DeVoref447a492018-08-13 11:14:28 -0700334 for (i = 0; i < ctx->revs->pending.nr; i++) {
335 struct object_array_entry *pending = ctx->revs->pending.objects + i;
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700336 struct object *obj = pending->item;
337 const char *name = pending->name;
Jeff King20739492014-10-15 18:43:19 -0400338 const char *path = pending->path;
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700339 if (obj->flags & (UNINTERESTING | SEEN))
340 continue;
341 if (obj->type == OBJ_TAG) {
342 obj->flags |= SEEN;
Matthew DeVoref447a492018-08-13 11:14:28 -0700343 ctx->show_object(obj, name, ctx->show_data);
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700344 continue;
345 }
Jeff King20739492014-10-15 18:43:19 -0400346 if (!path)
347 path = "";
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700348 if (obj->type == OBJ_TREE) {
Matthew DeVoref447a492018-08-13 11:14:28 -0700349 process_tree(ctx, (struct tree *)obj, base, path);
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700350 continue;
351 }
352 if (obj->type == OBJ_BLOB) {
Matthew DeVoref447a492018-08-13 11:14:28 -0700353 process_blob(ctx, (struct blob *)obj, base, path);
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700354 continue;
355 }
356 die("unknown pending object %s (%s)",
brian m. carlsonf2fd0762015-11-10 02:22:28 +0000357 oid_to_hex(&obj->oid), name);
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700358 }
Matthew DeVoref447a492018-08-13 11:14:28 -0700359 object_array_clear(&ctx->revs->pending);
Stefan Beller91904f52017-11-02 12:41:43 -0700360}
361
Matthew DeVoref447a492018-08-13 11:14:28 -0700362static void do_traverse(struct traversal_context *ctx)
Stefan Beller91904f52017-11-02 12:41:43 -0700363{
364 struct commit *commit;
365 struct strbuf csp; /* callee's scratch pad */
366 strbuf_init(&csp, PATH_MAX);
367
Matthew DeVoref447a492018-08-13 11:14:28 -0700368 while ((commit = get_revision(ctx->revs)) != NULL) {
Stefan Beller91904f52017-11-02 12:41:43 -0700369 /*
370 * an uninteresting boundary commit may not have its tree
371 * parsed yet, but we are not going to show them anyway
372 */
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700373 if (get_commit_tree(commit)) {
374 struct tree *tree = get_commit_tree(commit);
375 tree->object.flags |= NOT_USER_GIVEN;
376 add_pending_tree(ctx->revs, tree);
Jeff King97dd5122019-04-09 19:13:25 -0700377 } else if (commit->object.parsed) {
378 die(_("unable to load root tree for commit %s"),
379 oid_to_hex(&commit->object.oid));
Matthew DeVore99c9aa92018-10-05 14:31:24 -0700380 }
Matthew DeVoref447a492018-08-13 11:14:28 -0700381 ctx->show_commit(commit, ctx->show_data);
Stefan Bellerce5b6f92017-11-15 18:00:35 -0800382
Matthew DeVoref447a492018-08-13 11:14:28 -0700383 if (ctx->revs->tree_blobs_in_commit_order)
Stefan Bellerce5b6f92017-11-15 18:00:35 -0800384 /*
385 * NEEDSWORK: Adding the tree and then flushing it here
386 * needs a reallocation for each commit. Can we pass the
387 * tree directory without allocation churn?
388 */
Matthew DeVoref447a492018-08-13 11:14:28 -0700389 traverse_trees_and_blobs(ctx, &csp);
Stefan Beller91904f52017-11-02 12:41:43 -0700390 }
Matthew DeVoref447a492018-08-13 11:14:28 -0700391 traverse_trees_and_blobs(ctx, &csp);
Stefan Beller91904f52017-11-02 12:41:43 -0700392 strbuf_release(&csp);
Junio C Hamanoc64ed702006-09-04 21:50:12 -0700393}
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000394
395void traverse_commit_list(struct rev_info *revs,
396 show_commit_fn show_commit,
397 show_object_fn show_object,
398 void *show_data)
399{
Matthew DeVoref447a492018-08-13 11:14:28 -0700400 struct traversal_context ctx;
401 ctx.revs = revs;
402 ctx.show_commit = show_commit;
403 ctx.show_object = show_object;
404 ctx.show_data = show_data;
405 ctx.filter_fn = NULL;
406 ctx.filter_data = NULL;
407 do_traverse(&ctx);
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000408}
409
410void traverse_commit_list_filtered(
411 struct list_objects_filter_options *filter_options,
412 struct rev_info *revs,
413 show_commit_fn show_commit,
414 show_object_fn show_object,
415 void *show_data,
416 struct oidset *omitted)
417{
Matthew DeVoref447a492018-08-13 11:14:28 -0700418 struct traversal_context ctx;
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000419 filter_free_fn filter_free_fn = NULL;
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000420
Matthew DeVoref447a492018-08-13 11:14:28 -0700421 ctx.revs = revs;
422 ctx.show_object = show_object;
423 ctx.show_commit = show_commit;
424 ctx.show_data = show_data;
425 ctx.filter_fn = NULL;
426
427 ctx.filter_data = list_objects_filter__init(omitted, filter_options,
428 &ctx.filter_fn, &filter_free_fn);
429 do_traverse(&ctx);
430 if (ctx.filter_data && filter_free_fn)
431 filter_free_fn(ctx.filter_data);
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000432}