mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 14:02:48 +00:00

Added `struct git_config_entry`: a git_config_entry contains the key, the value, and the config file level from which a config element was found. Added `git_config_open_level`: build a single-level focused config object from a multi-level one. We are now storing `git_config_entry`s in the khash of the config_file
32 lines
742 B
C
32 lines
742 B
C
#include "clar_libgit2.h"
|
|
|
|
#include "filebuf.h"
|
|
#include "fileops.h"
|
|
#include "posix.h"
|
|
|
|
#define TEST_CONFIG "git-new-config"
|
|
|
|
void test_config_new__write_new_config(void)
|
|
{
|
|
const char *out;
|
|
git_config *config;
|
|
|
|
cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG));
|
|
|
|
cl_git_pass(git_config_set_string(config, "color.ui", "auto"));
|
|
cl_git_pass(git_config_set_string(config, "core.editor", "ed"));
|
|
|
|
git_config_free(config);
|
|
|
|
cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG));
|
|
|
|
cl_git_pass(git_config_get_string(&out, config, "color.ui"));
|
|
cl_assert_equal_s(out, "auto");
|
|
cl_git_pass(git_config_get_string(&out, config, "core.editor"));
|
|
cl_assert_equal_s(out, "ed");
|
|
|
|
git_config_free(config);
|
|
|
|
p_unlink(TEST_CONFIG);
|
|
}
|