Merge branch 'ef/fast-export'

* ef/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
This commit is contained in:
Junio C Hamano 2009-04-01 22:49:28 -07:00
commit dffc13166b
2 changed files with 26 additions and 2 deletions

View File

@ -363,7 +363,10 @@ static void get_tags_and_duplicates(struct object_array *pending,
break; break;
case OBJ_TAG: case OBJ_TAG:
tag = (struct tag *)e->item; tag = (struct tag *)e->item;
/* handle nested tags */
while (tag && tag->object.type == OBJ_TAG) { while (tag && tag->object.type == OBJ_TAG) {
parse_object(tag->object.sha1);
string_list_append(full_name, extra_refs)->util = tag; string_list_append(full_name, extra_refs)->util = tag;
tag = (struct tag *)tag->tagged; tag = (struct tag *)tag->tagged;
} }
@ -376,11 +379,17 @@ static void get_tags_and_duplicates(struct object_array *pending,
case OBJ_BLOB: case OBJ_BLOB:
handle_object(tag->object.sha1); handle_object(tag->object.sha1);
continue; continue;
default: /* OBJ_TAG (nested tags) is already handled */
warning("Tag points to object of unexpected type %s, skipping.",
typename(tag->object.type));
continue;
} }
break; break;
default: default:
die ("Unexpected object of type %s", warning("%s: Unexpected object of type %s, skipping.",
e->name,
typename(e->item->type)); typename(e->item->type));
continue;
} }
if (commit->util) if (commit->util)
/* more than one name for the same object */ /* more than one name for the same object */

View File

@ -262,4 +262,19 @@ test_expect_success 'cope with tagger-less tags' '
' '
test_expect_success 'set-up a few more tags for tag export tests' '
git checkout -f master &&
HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
git tag tree_tag -m "tagging a tree" $HEAD_TREE &&
git tag -a tree_tag-obj -m "tagging a tree" $HEAD_TREE &&
git tag tag-obj_tag -m "tagging a tag" tree_tag-obj &&
git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
'
# NEEDSWORK: not just check return status, but validate the output
test_expect_success 'tree_tag' 'git fast-export tree_tag'
test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj'
test_expect_success 'tag-obj_tag' 'git fast-export tag-obj_tag'
test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
test_done test_done