Skip to content

Commit 4f26c39

Browse files
committed
Merge branch 'ef/maint-fast-export' into maint
* ef/maint-fast-export: builtin-fast-export.c: handle nested tags builtin-fast-export.c: fix crash on tagged trees builtin-fast-export.c: turn error into warning test-suite: adding a test for fast-export with tag variants
2 parents fe4ce3a + aadd444 commit 4f26c39

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

builtin-fast-export.c

Lines changed: 11 additions & 2 deletions
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,11 +378,17 @@ static void get_tags_and_duplicates(struct object_array *pending,
375378
case OBJ_BLOB:
376379
handle_object(tag->object.sha1);
377380
continue;
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;
378385
}
379386
break;
380387
default:
381-
die ("Unexpected object of type %s",
382-
typename(e->item->type));
388+
warning("%s: Unexpected object of type %s, skipping.",
389+
e->name,
390+
typename(e->item->type));
391+
continue;
383392
}
384393
if (commit->util)
385394
/* more than one name for the same object */

t/t9301-fast-export.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,19 @@ test_expect_success 'cope with tagger-less tags' '
259259
260260
'
261261

262+
test_expect_success 'set-up a few more tags for tag export tests' '
263+
git checkout -f master &&
264+
HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
265+
git tag tree_tag -m "tagging a tree" $HEAD_TREE &&
266+
git tag -a tree_tag-obj -m "tagging a tree" $HEAD_TREE &&
267+
git tag tag-obj_tag -m "tagging a tag" tree_tag-obj &&
268+
git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
269+
'
270+
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_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+
262277
test_done

0 commit comments

Comments
 (0)