Commit 7623b1b63f787e7d8a4354db3a0a75d7b6039bf5

nulltoken 2012-06-11T11:33:13

repository: make git_repository_init() value the core.logallrefupdates config entry

diff --git a/src/repository.c b/src/repository.c
index 7181708..4e467e6 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -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? */
diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c
index 7e37941..2e70c51 100644
--- a/tests-clar/repo/init.c
+++ b/tests-clar/repo/init.c
@@ -241,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);
+}