summaryrefslogtreecommitdiff
path: root/tests/submodule/add.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/submodule/add.c')
-rw-r--r--tests/submodule/add.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/tests/submodule/add.c b/tests/submodule/add.c
index 05dbafd88..01625d3aa 100644
--- a/tests/submodule/add.c
+++ b/tests/submodule/add.c
@@ -2,6 +2,7 @@
#include "posix.h"
#include "path.h"
#include "submodule_helpers.h"
+#include "config/config_helpers.h"
#include "fileops.h"
static git_repository *g_repo = NULL;
@@ -13,26 +14,19 @@ void test_submodule_add__cleanup(void)
static void assert_submodule_url(const char* name, const char *url)
{
- git_config *cfg;
- const char *s;
git_buf key = GIT_BUF_INIT;
- cl_git_pass(git_repository_config(&cfg, g_repo));
cl_git_pass(git_buf_printf(&key, "submodule.%s.url", name));
- cl_git_pass(git_config_get_string(&s, cfg, git_buf_cstr(&key)));
- cl_assert_equal_s(s, url);
+ assert_config_entry_value(g_repo, git_buf_cstr(&key), url);
- git_config_free(cfg);
git_buf_free(&key);
}
void test_submodule_add__url_absolute(void)
{
git_submodule *sm;
- git_config *cfg;
git_repository *repo;
- const char *worktree_path;
git_buf dot_git_content = GIT_BUF_INIT;
g_repo = setup_fixture_submod2();
@@ -59,15 +53,12 @@ void test_submodule_add__url_absolute(void)
cl_git_pass(git_repository_open(&repo, "submod2/" "sm_libgit2"));
/* Verify worktree path is relative */
- cl_git_pass(git_repository_config(&cfg, repo));
- cl_git_pass(git_config_get_string(&worktree_path, cfg, "core.worktree"));
- cl_assert_equal_s("../../../sm_libgit2/", worktree_path);
+ assert_config_entry_value(repo, "core.worktree", "../../../sm_libgit2/");
/* Verify gitdir path is relative */
cl_git_pass(git_futils_readbuffer(&dot_git_content, "submod2/" "sm_libgit2" "/.git"));
cl_assert_equal_s("gitdir: ../.git/modules/sm_libgit2/", dot_git_content.ptr);
- git_config_free(cfg);
git_repository_free(repo);
git_buf_free(&dot_git_content);