builtin-fast-export.c: handle nested tags
When tags that points to tags are passed to fast-export, an error is given, saying "Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the object before referencing it's tag, to ensure the tag-info is fully initialized. In addition, it inserts a comment to point out where nested tags are handled. This is consistent with the comment for signed tags. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Erik Faye-Lund committed
Mar 23, 2009 at 12:53 UTC
1982467d9229e3c92157f2a41363365dcb866e86
2 files changed
+6
-3
builtin-fast-export.c
+4
-1
@@ -362,7 +362,10 @@ static void get_tags_and_duplicates(struct object_array *pending,
362
break;
363
case OBJ_TAG:
364
tag = (struct tag *)e->item;
365
+
366
+ /* handle nested tags */
367
while (tag && tag->object.type == OBJ_TAG) {
368
+ parse_object(tag->object.sha1);
369
string_list_append(full_name, extra_refs)->util = tag;
370
tag = (struct tag *)tag->tagged;
371
}
@@ -375,7 +378,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
378
case OBJ_BLOB:
379
handle_object(tag->object.sha1);
380
continue;
378
- default:
381
+ default: /* OBJ_TAG (nested tags) is already handled */
382
warning("Tag points to object of unexpected type %s, skipping.",
383
typename(tag->object.type));
384
continue;
t/t9301-fast-export.sh
+2
-2
@@ -271,7 +271,7 @@ test_expect_success 'set-up a few more tags for tag export tests' '
271
# NEEDSWORK: not just check return status, but validate the output
272
test_expect_success 'tree_tag' 'git fast-export tree_tag'
273
test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj'
274
-test_expect_failure 'tag-obj_tag' 'git fast-export tag-obj_tag'
275
-test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
274
+test_expect_success 'tag-obj_tag' 'git fast-export tag-obj_tag'
275
+test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
276
277
test_done