From: Junio C Hamano Date: Thu, 2 Apr 2009 05:49:28 +0000 (-0700) Subject: Merge branch 'ef/fast-export' X-Git-Tag: v1.6.3-rc0~47 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/dffc13166ba8950b2ddbac2406042751f96841b7?hp=-c 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 --- dffc13166ba8950b2ddbac2406042751f96841b7 diff --combined builtin-fast-export.c index 34a419c38e,f171ee4a2b..6731713223 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@@ -221,8 -221,7 +221,8 @@@ static void handle_commit(struct commi if (message) message += 2; - if (commit->parents) { + if (commit->parents && + get_object_mark(&commit->parents->item->object) != 0) { parse_commit(commit->parents->item); diff_tree_sha1(commit->parents->item->tree->object.sha1, commit->tree->object.sha1, "", &rev->diffopt); @@@ -363,7 -362,10 +363,10 @@@ static void get_tags_and_duplicates(str break; case OBJ_TAG: tag = (struct tag *)e->item; + + /* handle nested tags */ while (tag && tag->object.type == OBJ_TAG) { + parse_object(tag->object.sha1); string_list_append(full_name, extra_refs)->util = tag; tag = (struct tag *)tag->tagged; } @@@ -376,11 -378,17 +379,17 @@@ case OBJ_BLOB: handle_object(tag->object.sha1); 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; default: - die ("Unexpected object of type %s", - typename(e->item->type)); + warning("%s: Unexpected object of type %s, skipping.", + e->name, + typename(e->item->type)); + continue; } if (commit->util) /* more than one name for the same object */ diff --combined t/t9301-fast-export.sh index b860626bee,4a87f36258..8da9ce5459 --- a/t/t9301-fast-export.sh +++ b/t/t9301-fast-export.sh @@@ -8,9 -8,6 +8,9 @@@ test_description='git fast-export test_expect_success 'setup' ' + echo break it > file0 && + git add file0 && + test_tick && echo Wohlauf > file && git add file && test_tick && @@@ -60,8 -57,8 +60,8 @@@ test_expect_success 'fast-export master (cd new && git fast-import && test $MASTER != $(git rev-parse --verify refs/heads/partial) && - git diff master..partial && - git diff master^..partial^ && + git diff --exit-code master partial && + git diff --exit-code master^ partial^ && test_must_fail git rev-parse partial~2) ' @@@ -262,4 -259,19 +262,19 @@@ test_expect_success 'cope with tagger-l ' + 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