mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-07 06:18:08 +00:00
Merge pull request #760 from nulltoken/topic/logAllRefUpdates
make git_repository_init() value the core.logallrefupdates config entry
This commit is contained in:
commit
64e56478ad
@ -718,6 +718,9 @@ static int repo_init_config(const char *git_dir, bool is_bare, bool is_reinit)
|
||||
SET_REPO_CONFIG(int32, "core.repositoryformatversion", GIT_REPO_VERSION);
|
||||
SET_REPO_CONFIG(bool, "core.filemode", is_chmod_supported(git_buf_cstr(&cfg_path)));
|
||||
|
||||
if (!is_bare)
|
||||
SET_REPO_CONFIG(bool, "core.logallrefupdates", true);
|
||||
|
||||
if (!is_reinit && is_filesystem_case_insensitive(git_dir))
|
||||
SET_REPO_CONFIG(bool, "core.ignorecase", true);
|
||||
/* TODO: what other defaults? */
|
||||
|
||||
@ -166,14 +166,14 @@ void test_repo_init__additional_templates(void)
|
||||
git_buf_free(&path);
|
||||
}
|
||||
|
||||
static void assert_config_entry_on_init(const char *config_key, int expected_value)
|
||||
static void assert_config_entry_on_init_bytype(const char *config_key, int expected_value, bool is_bare)
|
||||
{
|
||||
git_config *config;
|
||||
int current_value;
|
||||
|
||||
cl_set_cleanup(&cleanup_repository, "config_entry");
|
||||
|
||||
cl_git_pass(git_repository_init(&_repo, "config_entry/test.git", 1));
|
||||
cl_git_pass(git_repository_init(&_repo, "config_entry/test.git", is_bare));
|
||||
git_repository_config(&config, _repo);
|
||||
|
||||
if (expected_value >= 0) {
|
||||
@ -189,6 +189,14 @@ static void assert_config_entry_on_init(const char *config_key, int expected_val
|
||||
git_config_free(config);
|
||||
}
|
||||
|
||||
static void assert_config_entry_on_init(const char *config_key, int expected_value)
|
||||
{
|
||||
assert_config_entry_on_init_bytype(config_key, expected_value, true);
|
||||
git_repository_free(_repo);
|
||||
|
||||
assert_config_entry_on_init_bytype(config_key, expected_value, false);
|
||||
}
|
||||
|
||||
void test_repo_init__detect_filemode(void)
|
||||
{
|
||||
#ifdef GIT_WIN32
|
||||
@ -233,3 +241,9 @@ void test_repo_init__reinit_doesnot_overwrite_ignorecase(void)
|
||||
|
||||
git_config_free(config);
|
||||
}
|
||||
|
||||
void test_repo_init__sets_logAllRefUpdates_according_to_type_of_repository(void)
|
||||
{
|
||||
assert_config_entry_on_init_bytype("core.logallrefupdates", GIT_ENOTFOUND, true);
|
||||
assert_config_entry_on_init_bytype("core.logallrefupdates", true, false);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user