Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-07-11 20:41:03 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-07-12 13:11:22 +0300
commit247d27c2c6868e808191e6090056ecece6da30c4 (patch)
treed85076a6dab42f1c682a7d4355c0cfdd94678b87 /tests/index
parent0d98af0911ebf55ba64cc0c9e17a3d450c77a9be (diff)
index: allow add_bypath to update submodules
Similarly to how git itself does it, allow the index update operation to stage a change in a submodule's HEAD.
Diffstat (limited to 'tests/index')
-rw-r--r--tests/index/bypath.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/index/bypath.c b/tests/index/bypath.c
index 08c9934ea..ddb766a22 100644
--- a/tests/index/bypath.c
+++ b/tests/index/bypath.c
@@ -21,3 +21,15 @@ void test_index_bypath__add_directory(void)
{
cl_git_fail_with(GIT_EDIRECTORY, git_index_add_bypath(g_idx, "just_a_dir"));
}
+
+void test_index_bypath__add_submodule(void)
+{
+ unsigned int status;
+ const char *sm_name = "sm_changed_head";
+
+ cl_git_pass(git_submodule_status(&status, g_repo, sm_name, 0));
+ cl_assert_equal_i(GIT_SUBMODULE_STATUS_WD_MODIFIED, status & GIT_SUBMODULE_STATUS_WD_MODIFIED);
+ cl_git_pass(git_index_add_bypath(g_idx, sm_name));
+ cl_git_pass(git_submodule_status(&status, g_repo, sm_name, 0));
+ cl_assert_equal_i(0, status & GIT_SUBMODULE_STATUS_WD_MODIFIED);
+}