diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-05-02 14:24:04 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-02 14:24:04 -0700 |
commit | 85916549980c709ae14f8a935a5a6266a4a80b26 (patch) | |
tree | f337cf0d6cfa13156f9cbe59eab72285fda99e24 /environment.c | |
parent | ffaa7c5d4f064ae2ce6b0ea906bd240810ecee86 (diff) | |
parent | 274db840b48d144a8f0f8d8bd324365670c67275 (diff) | |
download | git-85916549980c709ae14f8a935a5a6266a4a80b26.tar.gz |
Merge branch 'jk/check-repository-format' into maint
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.c | 23 |
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; +} |