Skip to content

Commit aadd444

Browse files
kusmagitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 426193c commit aadd444

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

builtin-fast-export.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,10 @@ static void get_tags_and_duplicates(struct object_array *pending,
362362
break;
363363
case OBJ_TAG:
364364
tag = (struct tag *)e->item;
365+
366+
/* handle nested tags */
365367
while (tag && tag->object.type == OBJ_TAG) {
368+
parse_object(tag->object.sha1);
366369
string_list_append(full_name, extra_refs)->util = tag;
367370
tag = (struct tag *)tag->tagged;
368371
}
@@ -375,7 +378,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
375378
case OBJ_BLOB:
376379
handle_object(tag->object.sha1);
377380
continue;
378-
default:
381+
default: /* OBJ_TAG (nested tags) is already handled */
379382
warning("Tag points to object of unexpected type %s, skipping.",
380383
typename(tag->object.type));
381384
continue;

t/t9301-fast-export.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ test_expect_success 'set-up a few more tags for tag export tests' '
271271
# NEEDSWORK: not just check return status, but validate the output
272272
test_expect_success 'tree_tag' 'git fast-export tree_tag'
273273
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'
276276

277277
test_done

0 commit comments

Comments
 (0)