Permalink
Browse files

Merge pull request #760 from nulltoken/topic/logAllRefUpdates

make git_repository_init() value the core.logallrefupdates config entry
  • Loading branch information...
2 parents 14ebe51 + 7623b1b commit 64e56478ad8b3310e957701ebe234764f9f4a147 @arrbee arrbee committed Jun 12, 2012
Showing with 19 additions and 2 deletions.
  1. +3 −0 src/repository.c
  2. +16 −2 tests-clar/repo/init.c
View
@@ -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);
+}

0 comments on commit 64e5647

Please sign in to comment.