Commit 4536574acc85d8c78ceeac872eed6e4f79ef9aaa

Carlos Martín Nieto 2015-05-05T16:29:38

submodule: test more accurately for non-existence The current code will always fail, but only because it's asking for a string on a live config. Take a snapshot and make sure we fail with ENOTFOUND instead of any old error.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/tests/submodule/modify.c b/tests/submodule/modify.c
index 77f86e5..81c34de 100644
--- a/tests/submodule/modify.c
+++ b/tests/submodule/modify.c
@@ -41,10 +41,10 @@ void test_submodule_modify__init(void)
 	git_config_free(cfg);
 
 	/* confirm no submodule data in config */
-	cl_git_pass(git_repository_config(&cfg, g_repo));
-	cl_git_fail(git_config_get_string(&str, cfg, "submodule.sm_unchanged.url"));
-	cl_git_fail(git_config_get_string(&str, cfg, "submodule.sm_changed_head.url"));
-	cl_git_fail(git_config_get_string(&str, cfg, "submodule.sm_added_and_uncommited.url"));
+	cl_git_pass(git_repository_config_snapshot(&cfg, g_repo));
+	cl_git_fail_with(GIT_ENOTFOUND, git_config_get_string(&str, cfg, "submodule.sm_unchanged.url"));
+	cl_git_fail_with(GIT_ENOTFOUND, git_config_get_string(&str, cfg, "submodule.sm_changed_head.url"));
+	cl_git_fail_with(GIT_ENOTFOUND, git_config_get_string(&str, cfg, "submodule.sm_added_and_uncommited.url"));
 	git_config_free(cfg);
 
 	/* call init and see that settings are copied */