Commit 64e56478 by Russell Belfer

Merge pull request #760 from nulltoken/topic/logAllRefUpdates

make git_repository_init() value the core.logallrefupdates config entry 
parents 14ebe518 7623b1b6
...@@ -718,6 +718,9 @@ static int repo_init_config(const char *git_dir, bool is_bare, bool is_reinit) ...@@ -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(int32, "core.repositoryformatversion", GIT_REPO_VERSION);
SET_REPO_CONFIG(bool, "core.filemode", is_chmod_supported(git_buf_cstr(&cfg_path))); 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)) if (!is_reinit && is_filesystem_case_insensitive(git_dir))
SET_REPO_CONFIG(bool, "core.ignorecase", true); SET_REPO_CONFIG(bool, "core.ignorecase", true);
/* TODO: what other defaults? */ /* TODO: what other defaults? */
......
...@@ -166,14 +166,14 @@ void test_repo_init__additional_templates(void) ...@@ -166,14 +166,14 @@ void test_repo_init__additional_templates(void)
git_buf_free(&path); 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; git_config *config;
int current_value; int current_value;
cl_set_cleanup(&cleanup_repository, "config_entry"); 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); git_repository_config(&config, _repo);
if (expected_value >= 0) { if (expected_value >= 0) {
...@@ -189,6 +189,14 @@ static void assert_config_entry_on_init(const char *config_key, int expected_val ...@@ -189,6 +189,14 @@ static void assert_config_entry_on_init(const char *config_key, int expected_val
git_config_free(config); 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) void test_repo_init__detect_filemode(void)
{ {
#ifdef GIT_WIN32 #ifdef GIT_WIN32
...@@ -233,3 +241,9 @@ void test_repo_init__reinit_doesnot_overwrite_ignorecase(void) ...@@ -233,3 +241,9 @@ void test_repo_init__reinit_doesnot_overwrite_ignorecase(void)
git_config_free(config); 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment