Commit b426ac90 by Carlos Martín Nieto

index: test that an unregistered submodule gets staged

When we pass the path of a repository to `_bypath()`, we should behave
like git and stage it as a `_COMMIT` regardless of whether it is
registered a a submodule.
parent 63e5b551
...@@ -34,9 +34,15 @@ void test_index_bypath__add_submodule(void) ...@@ -34,9 +34,15 @@ void test_index_bypath__add_submodule(void)
cl_assert_equal_i(0, status & GIT_SUBMODULE_STATUS_WD_MODIFIED); cl_assert_equal_i(0, status & GIT_SUBMODULE_STATUS_WD_MODIFIED);
} }
void test_index_bypath__add_submodule_old_style(void) void test_index_bypath__add_submodule_unregistered(void)
{ {
const char *sm_name = "not-submodule"; const char *sm_name = "not-submodule";
const char *sm_head = "68e92c611b80ee1ed8f38314ff9577f0d15b2444";
const git_index_entry *entry;
cl_git_pass(git_index_add_bypath(g_idx, sm_name)); cl_git_pass(git_index_add_bypath(g_idx, sm_name));
cl_assert(entry = git_index_get_bypath(g_idx, sm_name, 0));
cl_assert_equal_s(sm_head, git_oid_tostr_s(&entry->id));
cl_assert_equal_s(sm_name, entry->path);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment