summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-13 14:12:28 -0700
committerJunio C Hamano <gitster@pobox.com>2016-04-13 14:12:28 -0700
commit907c416534dbf110a4659b64ae65806f2b1e8d4d (patch)
tree5e7b98dbbd50e7c943ae60c837db37b3dabcdf60 /environment.c
parent7b0d47b3b6b5b64e02a5aa06b0452cadcdb18355 (diff)
parent274db840b48d144a8f0f8d8bd324365670c67275 (diff)
downloadgit-907c416534dbf110a4659b64ae65806f2b1e8d4d.tar.gz
Merge branch 'jk/check-repository-format'
The repository set-up sequence has been streamlined (the biggest change is that there is no longer git_config_early()), so that we do not attempt to look into refs/* when we know we do not have a Git repository. * jk/check-repository-format: verify_repository_format: mark messages for translation setup: drop repository_format_version global setup: unify repository version callbacks init: use setup.c's repo version verification setup: refactor repo format reading and verification config: drop git_config_early check_repository_format_gently: stop using git_config_early lazily load core.sharedrepository wrap shared_repository global in get/set accessors setup: document check_repository_format()
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/environment.c b/environment.c
index 6cc0a7780f..57acb2fe2a 100644
--- a/environment.c
+++ b/environment.c
@@ -25,11 +25,9 @@ int log_all_ref_updates = -1; /* unspecified */
int warn_ambiguous_refs = 1;
int warn_on_object_refname_ambiguity = 1;
int ref_paranoia = -1;
-int repository_format_version;
int repository_format_precious_objects;
const char *git_commit_encoding;
const char *git_log_output_encoding;
-int shared_repository = PERM_UMASK;
const char *apply_default_whitespace;
const char *apply_default_ignorewhitespace;
const char *git_attributes_file;
@@ -324,3 +322,24 @@ const char *get_commit_output_encoding(void)
{
return git_commit_encoding ? git_commit_encoding : "UTF-8";
}
+
+static int the_shared_repository = PERM_UMASK;
+static int need_shared_repository_from_config = 1;
+
+void set_shared_repository(int value)
+{
+ the_shared_repository = value;
+ need_shared_repository_from_config = 0;
+}
+
+int get_shared_repository(void)
+{
+ if (need_shared_repository_from_config) {
+ const char *var = "core.sharedrepository";
+ const char *value;
+ if (!git_config_get_value(var, &value))
+ the_shared_repository = git_config_perm(var, value);
+ need_shared_repository_from_config = 0;
+ }
+ return the_shared_repository;
+}