]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-fast-export.c
fast-export: Omit tags that tag trees
[thirdparty/git.git] / builtin-fast-export.c
index e0cfa606dc2ae293c2c2c999f22d5858fee60d3b..8c90a2df677030867909ef337c33343a62638a12 100644 (file)
@@ -289,6 +289,21 @@ static void handle_tag(const char *name, struct tag *tag)
        char *buf;
        const char *tagger, *tagger_end, *message;
        size_t message_size = 0;
+       struct object *tagged;
+
+       /* Trees have no identifer in fast-export output, thus we have no way
+        * to output tags of trees, tags of tags of trees, etc.  Simply omit
+        * such tags.
+        */
+       tagged = tag->tagged;
+       while (tagged->type == OBJ_TAG) {
+               tagged = ((struct tag *)tagged)->tagged;
+       }
+       if (tagged->type == OBJ_TREE) {
+               warning("Omitting tag %s,\nsince tags of trees (or tags of tags of trees, etc.) are not supported.",
+                       sha1_to_hex(tag->object.sha1));
+               return;
+       }
 
        buf = read_sha1_file(tag->object.sha1, &type, &size);
        if (!buf)