summaryrefslogtreecommitdiff
path: root/tests/object/tree/write.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2016-03-04 12:34:38 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2016-03-04 12:38:28 +0100
commitea5bf6bbcead5a9ba24a38c4da62ee87059c5c9f (patch)
tree8fa7398e57a81cc2a357831b9289de27c3edd1d3 /tests/object/tree/write.c
parent16099833772cb497eac4118350e974abf08c8032 (diff)
downloadlibgit2-cmn/treebuilder-submodule.tar.gz
treebuilder: don't try to verify submodules exist in the odbcmn/treebuilder-submodule
Submodules don't exist in the objectdb and the code is making us try to look for a blob with its commit id, which is obviously not going to work. Skip the test if the user wants to insert a submodule.
Diffstat (limited to 'tests/object/tree/write.c')
-rw-r--r--tests/object/tree/write.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/object/tree/write.c b/tests/object/tree/write.c
index 341f5db72..a9decf9c1 100644
--- a/tests/object/tree/write.c
+++ b/tests/object/tree/write.c
@@ -490,13 +490,25 @@ static void test_invalid_objects(bool should_allow_invalid)
git_treebuilder_free(builder);
}
+static void test_inserting_submodule(void)
+{
+ git_treebuilder *bld;
+ git_oid sm_id;
+
+ cl_git_pass(git_treebuilder_new(&bld, g_repo, NULL));
+ cl_git_pass(git_treebuilder_insert(NULL, bld, "sm", &sm_id, GIT_FILEMODE_COMMIT));
+ git_treebuilder_free(bld);
+}
+
void test_object_tree_write__object_validity(void)
{
/* Ensure that we cannot add invalid objects by default */
test_invalid_objects(false);
+ test_inserting_submodule();
/* Ensure that we can turn off validation */
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 0));
test_invalid_objects(true);
+ test_inserting_submodule();
}