diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2018-07-18 21:04:13 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2018-07-18 21:07:57 +0200 |
| commit | 2dff7e282da77f6b791e843ec267d9ddecabc187 (patch) | |
| tree | c6240328234c88d597f09d9845424d095324a1d6 /tests/object | |
| parent | 99bb98c0e8abb97b1daa3aff0307b93ed9291c08 (diff) | |
| download | libgit2-2dff7e282da77f6b791e843ec267d9ddecabc187.tar.gz | |
tree: accept null ids in existing trees when updating
When we add entries to a treebuilder we validate them. But we validate even
those that we're adding because they exist in the base tree. This disables
using the normal mechanisms on these trees, even to fix them.
Keep track of whether the entry we're appending comes from an existing tree and
bypass the name and id validation if it's from existing data.
Diffstat (limited to 'tests/object')
| -rw-r--r-- | tests/object/tree/update.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/object/tree/update.c b/tests/object/tree/update.c index b76e8612a..167faecbb 100644 --- a/tests/object/tree/update.c +++ b/tests/object/tree/update.c @@ -284,3 +284,18 @@ void test_object_tree_update__add_conflict2(void) cl_git_fail(git_tree_create_updated(&tree_updater_id, g_repo, NULL, 2, updates)); } + +void test_object_tree_update__remove_invalid_submodule(void) +{ + git_tree *baseline; + git_oid updated_tree_id, baseline_id; + git_tree_update updates[] = { + {GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB, "submodule"}, + }; + + cl_git_pass(git_oid_fromstr(&baseline_id, "396c7f1adb7925f51ba13a75f48252f44c5a14a2")); + cl_git_pass(git_tree_lookup(&baseline, g_repo, &baseline_id)); + cl_git_pass(git_tree_create_updated(&updated_tree_id, g_repo, baseline, 1, updates)); + + git_tree_free(baseline); +} |
