]> git.ipfire.org Git - thirdparty/git.git/commitdiff
list-objects: move tag processing into its own function
authorPatrick Steinhardt <ps@pks.im>
Fri, 9 Apr 2021 11:28:02 +0000 (13:28 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 11 Apr 2021 06:03:20 +0000 (23:03 -0700)
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>
list-objects.c

index e19589baa045fe053d9bef285c78513b97f1f34c..a5a60301cb28d473423112a2f3daf1408a3359b7 100644 (file)
@@ -213,6 +213,14 @@ static void process_tree(struct traversal_context *ctx,
        free_tree_buffer(tree);
 }
 
+static void process_tag(struct traversal_context *ctx,
+                       struct tag *tag,
+                       const char *name)
+{
+       tag->object.flags |= SEEN;
+       ctx->show_object(&tag->object, name, ctx->show_data);
+}
+
 static void mark_edge_parents_uninteresting(struct commit *commit,
                                            struct rev_info *revs,
                                            show_edge_fn show_edge)
@@ -334,8 +342,7 @@ static void traverse_trees_and_blobs(struct traversal_context *ctx,
                if (obj->flags & (UNINTERESTING | SEEN))
                        continue;
                if (obj->type == OBJ_TAG) {
-                       obj->flags |= SEEN;
-                       ctx->show_object(obj, name, ctx->show_data);
+                       process_tag(ctx, (struct tag *)obj, name);
                        continue;
                }
                if (!path)