test-suite: adding a test for fast-export with tag variants
PATCH 1/4 test-suite: adding a test for fast-export with tag variants
The first two new tests are crashing, so I'm adding them commented out as they exit with unpredictable return-codes.
--- t/t9301-fast-export.sh | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
t/t9301-fast-export.sh +13 -1
@@ -28,7 +28,12 @@ test_expect_success 'setup' ' git commit -m sitzt file2 && test_tick && git tag -a -m valentin muss && - git merge -s ours master + git merge -s ours 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 '
@@ -259,4 +264,11 @@ test_expect_success 'cope with tagger-less tags' ' ' +# NEEDSWORK: not just check return status, but validate the output +# two tests commented out due to crash and thus unreliable return code +#test_expect_success 'tree_tag' 'git fast-export tree_tag' +#test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj' +test_expect_failure 'tag-obj_tag' 'git fast-export tag-obj_tag' +test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj' + test_done
Signature · 1 line
1.6.2.1.225.g9a4a0.dirty
PATCH 2/4 builtin-fast-export.c: turn error into warning
fast-import doesn't have a syntax to support tree-objects (and some other object-types), so fast-export shouldn't handle them. However, aborting the operation is a bit drastic. This patch turns the error into a warning instead.
--- builtin-fast-export.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
builtin-fast-export.c +4 -2
@@ -378,8 +378,10 @@ static void get_tags_and_duplicates(struct object_array *pending, }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 */
Signature · 1 line
1.6.2.1.225.g9a4a0.dirty
PATCH 3/4 builtin-fast-export.c: fix crash on tagged trees
If a tag object points to a tree (or another unhandled type), the commit- pointer is left uninitialized and later dereferenced. This patch adds a default case to the switch that issues a warning and skips the object.
--- builtin-fast-export.c | 4 ++++ t/t9301-fast-export.sh | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-)
builtin-fast-export.c +4 -0
@@ -375,6 +375,10 @@ static void get_tags_and_duplicates(struct object_array *pending,case OBJ_BLOB :handle_object (tag->object.sha1);continue ; +default : +warning ("Tag points to object of unexpected type %s, skipping." , +typename (tag->object.type)); +continue ; }break ;default :
t/t9301-fast-export.sh +2 -3
@@ -265,9 +265,8 @@ test_expect_success 'cope with tagger-less tags' ' ' # NEEDSWORK: not just check return status, but validate the output -# two tests commented out due to crash and thus unreliable return code -#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 'tree_tag' 'git fast-export tree_tag' +test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj' test_expect_failure 'tag-obj_tag' 'git fast-export tag-obj_tag' test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
Signature · 1 line
1.6.2.1.225.g9a4a0.dirty
PATCH 4/4 builtin-fast-export.c: handle nested tags
When tags that points to tags are passed to fast-export, an error 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.
--- builtin-fast-export.c | 5 ++++- t/t9301-fast-export.sh | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-)
builtin-fast-export.c +4 -1
@@ -362,7 +362,10 @@ static void get_tags_and_duplicates(struct object_array *pending,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; }
@@ -375,7 +378,7 @@ static void get_tags_and_duplicates(struct object_array *pending,case OBJ_BLOB :handle_object (tag->object.sha1);continue ; -default : +default :/* OBJ_TAG (nested tags) is already handled */ warning ("Tag points to object of unexpected type %s, skipping." ,typename (tag->object.type));continue ;
t/t9301-fast-export.sh +2 -2
@@ -267,7 +267,7 @@ test_expect_success 'cope with tagger-less tags' ' # 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_failure 'tag-obj_tag' 'git fast-export tag-obj_tag' -test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_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
Signature · 1 line
1.6.2.1.225.g9a4a0.dirty
OK, I see now that the previous patch-series has been merged to "pu". Is there a reason why this updated patch-series hasn't superseded it? Did I do something wrong when I resubmitted it? And what do I need to do to get these patches going forward from there?
Quoted 42 lines · Erik Faye-Lund
The first two new tests are crashing, so I'm adding them commented out as they exit with unpredictable return-codes.
Signed-off-by Erik Faye-Lund <[email protected]>---
t/t9301-fast-export.sh | 14 +++++++++++++-1 files changed, 13 insertions(+), 1 deletions(-)t/t9301-fast-export.sh +0
-0@@ -28,7 +28,12 @@ test_expect_success 'setup' 'git commit -m sitzt file2 &&
test_tick &&
git tag -a -m valentin muss &&
- git merge -s ours master
+ git merge -s ours 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'
t/t9301-fast-export.sh +0
-0@@ -259,4 +264,11 @@ test_expect_success 'cope with tagger-less tags' ''
t/t9301-fast-export.sh +7
-0+# NEEDSWORK: not just check return status, but validate the output +# two tests commented out due to crash and thus unreliable return code +#test_expect_success 'tree_tag' 'git fast-export tree_tag' +#test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj' +test_expect_failure 'tag-obj_tag' 'git fast-export tag-obj_tag' +test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj' +test_done
--
1.6.2.1.225.g9a4a0.dirty
Signature · 3 lines
Erik "kusma" Faye-Lund [email protected] (+47) 986 59 656
Quoted 2 lines · Erik Faye-Lund
OK, I see now that the previous patch-series has been merged to "pu". Is there a reason why this updated patch-series hasn't superseded it?
Even if the tested program crashes, it is Ok to test them inside expect_failure, so I'd suggest not commenting the first two out.
But running the tests with the first patch applied to the same base as where v1 was applied gives this, which is a more serious issue:
$ sh t9301-fast-export.sh 2>&1 | tail -n 2
* still have 4 known breakage(s)
* failed 6 among remaining 15 test(s)In other words, the changes to the set-up part seem to break unrelated tests. Why can such an update supersede the previous one?
Quoted 2 lines · Junio C Hamano
Even if the tested program crashes, it is Ok to test them inside
expect_failure, so I'd suggest not commenting the first two out.
OK, the reason why I didn't want to do that is because the test appears to succeed on windows when it crashes. But you might not care too much about that ;)
Quoted 9 lines
But running the tests with the first patch applied to the same base as where v1 was applied gives this, which is a more serious issue:
$ sh t9301-fast-export.sh 2>&1 | tail -n 2 * still have 4 known breakage(s) * failed 6 among remaining 15 test(s)In other words, the changes to the set-up part seem to break unrelated tests. Why can such an update supersede the previous one?
That's weird. I did test it properly before I applied it, and I don't recall having any failures on Linux. On Windows, I get lots of failures with vanilla git.git, and I don't have access to my Linux-box right now, so I can't easily verify this until that box comes up again. I did see that another patch (ebeec7d) has made it's way into the test since I submitted it - perhaps these two collided?
But OK, I'll have a look at it when that box comes up, and see if I can come up with a good patch-series.
Signature · 3 lines
Erik "kusma" Faye-Lund [email protected] (+47) 986 59 656
Quoted 7 lines · Erik Faye-Lund
Quoted 7 lines
But running the tests with the first patch applied to the same base as where v1 was applied gives this, which is a more serious issue:
$ sh t9301-fast-export.sh 2>&1 | tail -n 2 * still have 4 known breakage(s) * failed 6 among remaining 15 test(s)
Quoted 5 lines
Quoted 2 lines
In other words, the changes to the set-up part seem to break unrelated tests. Why can such an update supersede the previous one?
That's weird. I did test it properly before I applied it, and I don't recall having any failures on Linux.
I think it is just the matter of doing something like this instead of your patch [PATCH v2 1/4]. Either that, or I think you need to adjust the existing tests that try to export --all and get hit by the fast that you added the tags you already knew the old code had trouble with in the test setup for them.
-- >8 --
From: Erik Faye-Lund <[email protected]>
Date: Mon, 23 Mar 2009 12:53:06 +0000
Subject: [PATCH] test-suite: adding a test for fast-export with tag variants
--- t/t9301-fast-export.sh | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
t/t9301-fast-export.sh +16 -0
@@ -259,4 +259,20 @@ 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 +# two tests commented out due to crash and thus unreliable return code +test_expect_failure 'tree_tag' 'git fast-export tree_tag' +test_expect_failure 'tree_tag-obj' 'git fast-export tree_tag-obj' +test_expect_failure 'tag-obj_tag' 'git fast-export tag-obj_tag' +test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj' + test_done
Signature · 1 line
1.6.2.1