list-objects: move tag processing into its own function
Move processing of tags into its own function to make the logic easier to extend when we're going to implement filtering for tags. No change in behaviour is expected from this commit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Apr 9, 2021 at 13:28 UTC
628d81be6c007de5aa0fa352b912b89f74a5cfa7
1 file changed
+9
-2
list-objects.c
+9
-2
@@ -213,6 +213,14 @@ static void process_tree(struct traversal_context *ctx,
213
free_tree_buffer(tree);
214
}
215
216
+static void process_tag(struct traversal_context *ctx,
217
+ struct tag *tag,
218
+ const char *name)
219
+{
220
+ tag->object.flags |= SEEN;
221
+ ctx->show_object(&tag->object, name, ctx->show_data);
222
+}
223
+
224
static void mark_edge_parents_uninteresting(struct commit *commit,
225
struct rev_info *revs,
226
show_edge_fn show_edge)
@@ -334,8 +342,7 @@ static void traverse_trees_and_blobs(struct traversal_context *ctx,
342
if (obj->flags & (UNINTERESTING | SEEN))
343
continue;
344
if (obj->type == OBJ_TAG) {
337
- obj->flags |= SEEN;
338
- ctx->show_object(obj, name, ctx->show_data);
345
+ process_tag(ctx, (struct tag *)obj, name);
346
continue;
347
}
348
if (!path)