Commit 09c15a7fc920f50b23669ededaa7b19fd045e266

Patrick Steinhardt 2017-10-09T09:08:19

tests: checkout::tree: check that the status list catches mode changes While we verify that we have no mode changes after calling `git_checkout_tree`, we do not verify that the `p_chmod` calls actually resulted in a changed entry. While we should assume that this works due to separate tests for the status list, we should test for the change being listed to avoid programming errors in the test.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index d7e7569..56513ea 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -1541,6 +1541,7 @@ void test_checkout_tree__mode_change_is_force_updated(void)
 	/* update the mode on-disk */
 	cl_must_pass(p_chmod("testrepo/README", 0755));
 
+	assert_status_entrycount(g_repo, 1);
 	cl_git_pass(git_checkout_tree(g_repo, obj, &g_opts));
 	assert_status_entrycount(g_repo, 0);
 
@@ -1548,6 +1549,7 @@ void test_checkout_tree__mode_change_is_force_updated(void)
 	cl_must_pass(p_chmod("testrepo/README", 0755));
 	cl_must_pass(git_index_add_bypath(index, "README"));
 
+	assert_status_entrycount(g_repo, 1);
 	cl_git_pass(git_checkout_tree(g_repo, obj, &g_opts));
 	assert_status_entrycount(g_repo, 0);