From 4e72551edb91a6645273f38400c9196a942802ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 18 Sep 2018 11:04:40 +0200 Subject: index: failing more thorough test for adding colliding path We've had tests since v0.21 that we error out when trying to add a colliding path to the index, but it turns out that right now we remove the already-existing path from the index instead of leaving it alone. --- tests/index/collision.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/index/collision.c b/tests/index/collision.c index 41eb7bfdc..f6f8d4a16 100644 --- a/tests/index/collision.c +++ b/tests/index/collision.c @@ -26,6 +26,7 @@ void test_index_collision__cleanup(void) void test_index_collision__add(void) { git_index_entry entry; + git_tree_entry *tentry; git_oid tree_id; git_tree *tree; @@ -39,12 +40,21 @@ void test_index_collision__add(void) entry.path = "a/b"; cl_git_pass(git_index_add(g_index, &entry)); + /* Check a/b exists here */ + cl_git_pass(git_index_write_tree(&tree_id, g_index)); + cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id)); + cl_git_pass(git_tree_entry_bypath(&tentry, tree, "a/b")); + git_tree_entry_free(tentry); + /* create a tree/blob collision */ entry.path = "a/b/c"; cl_git_fail(git_index_add(g_index, &entry)); + /* a/b should still exist here */ cl_git_pass(git_index_write_tree(&tree_id, g_index)); cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id)); + cl_git_pass(git_tree_entry_bypath(&tentry, tree, "a/b")); + git_tree_entry_free(tentry); git_tree_free(tree); } -- cgit v1.2.1