diff options
Diffstat (limited to 'environment.c')
-rw-r--r-- | environment.c | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/environment.c b/environment.c index b3296ce..a73ba9c 100644 --- a/environment.c +++ b/environment.c @@ -7,19 +7,28 @@ * even if you might want to know where the git directory etc * are. */ -#include "cache.h" +#include "git-compat-util.h" +#include "abspath.h" #include "branch.h" +#include "convert.h" #include "environment.h" +#include "gettext.h" #include "repository.h" #include "config.h" #include "refs.h" #include "fmt-merge-msg.h" #include "commit.h" #include "strvec.h" -#include "object-store.h" +#include "object-file.h" +#include "object-store-ll.h" +#include "path.h" +#include "replace-object.h" #include "tmp-objdir.h" #include "chdir-notify.h" +#include "setup.h" #include "shallow.h" +#include "trace.h" +#include "write-or-die.h" int trust_executable_bit = 1; int trust_ctime = 1; @@ -33,7 +42,6 @@ int is_bare_repository_cfg = -1; /* unspecified */ int warn_ambiguous_refs = 1; int warn_on_object_refname_ambiguity = 1; int repository_format_precious_objects; -int repository_format_worktree_config; const char *git_commit_encoding; const char *git_log_output_encoding; char *apply_default_whitespace; @@ -50,17 +58,13 @@ size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE; size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT; size_t delta_base_cache_limit = 96 * 1024 * 1024; unsigned long big_file_threshold = 512 * 1024 * 1024; -int pager_use_color = 1; const char *editor_program; const char *askpass_program; const char *excludes_file; enum auto_crlf auto_crlf = AUTO_CRLF_FALSE; -int read_replace_refs = 1; -char *git_replace_ref_base; enum eol core_eol = EOL_UNSET; int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN; -char *check_roundtrip_encoding = "SHIFT-JIS"; -unsigned whitespace_rule_cfg = WS_DEFAULT_RULE; +const char *check_roundtrip_encoding = "SHIFT-JIS"; enum branch_track git_branch_track = BRANCH_TRACK_REMOTE; enum rebase_setup_type autorebase = AUTOREBASE_NEVER; enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED; @@ -69,7 +73,7 @@ enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED; #endif enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE; char *notes_ref_name; -int grafts_replace_parents = 1; +int grafts_keep_true_parents; int core_apply_sparse_checkout; int core_sparse_checkout_cone; int sparse_expect_files_outside_of_patterns; @@ -77,6 +81,20 @@ int merge_log_config = -1; int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */ unsigned long pack_size_limit_cfg; enum log_refs_config log_all_ref_updates = LOG_REFS_UNSET; +int max_allowed_tree_depth = +#ifdef _MSC_VER + /* + * When traversing into too-deep trees, Visual C-compiled Git seems to + * run into some internal stack overflow detection in the + * `RtlpAllocateHeap()` function that is called from within + * `git_inflate_init()`'s call tree. The following value seems to be + * low enough to avoid that by letting Git exit with an error before + * the stack overflow can occur. + */ + 512; +#else + 2048; +#endif #ifndef PROTECT_HFS_DEFAULT #define PROTECT_HFS_DEFAULT 0 @@ -92,7 +110,7 @@ int protect_ntfs = PROTECT_NTFS_DEFAULT; * The character that begins a commented line in user-editable file * that is subject to stripspace. */ -char comment_line_char = '#'; +const char *comment_line_str = "#"; int auto_comment_line_char; /* Parallel index stat data preload? */ @@ -103,10 +121,8 @@ char *git_work_tree_cfg; static char *git_namespace; -static char *super_prefix; - /* - * Repository-local GIT_* environment variables; see cache.h for details. + * Repository-local GIT_* environment variables; see environment.h for details. */ const char * const local_repo_env[] = { ALTERNATE_DB_ENVIRONMENT, @@ -122,7 +138,6 @@ const char * const local_repo_env[] = { NO_REPLACE_OBJECTS_ENVIRONMENT, GIT_REPLACE_REF_BASE_ENVIRONMENT, GIT_PREFIX_ENVIRONMENT, - GIT_SUPER_PREFIX_ENVIRONMENT, GIT_SHALLOW_FILE_ENVIRONMENT, GIT_COMMON_DIR_ENVIRONMENT, NULL @@ -162,6 +177,7 @@ const char *getenv_safe(struct strvec *argv, const char *name) void setup_git_env(const char *git_dir) { + char *git_replace_ref_base; const char *shallow_file; const char *replace_ref_base; struct set_gitdir_args args = { NULL }; @@ -180,16 +196,20 @@ void setup_git_env(const char *git_dir) strvec_clear(&to_free); if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT)) - read_replace_refs = 0; + disable_replace_refs(); replace_ref_base = getenv(GIT_REPLACE_REF_BASE_ENVIRONMENT); - free(git_replace_ref_base); git_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base : "refs/replace/"); + update_ref_namespace(NAMESPACE_REPLACE, git_replace_ref_base); + free(git_namespace); git_namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT)); shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT); if (shallow_file) set_alternate_shallow_file(the_repository, shallow_file, 0); + + if (git_env_bool(NO_LAZY_FETCH_ENVIRONMENT, 0)) + fetch_if_missing = 0; } int is_bare_repository(void) @@ -233,16 +253,6 @@ const char *strip_namespace(const char *namespaced_ref) return NULL; } -const char *get_super_prefix(void) -{ - static int initialized; - if (!initialized) { - super_prefix = xstrdup_or_null(getenv(GIT_SUPER_PREFIX_ENVIRONMENT)); - initialized = 1; - } - return super_prefix; -} - static int git_work_tree_initialized; /* @@ -333,10 +343,10 @@ static void set_git_dir_1(const char *path) setup_git_env(path); } -static void update_relative_gitdir(const char *name, +static void update_relative_gitdir(const char *name UNUSED, const char *old_cwd, const char *new_cwd, - void *data) + void *data UNUSED) { char *path = reparent_relative_path(old_cwd, new_cwd, get_git_dir()); struct tmp_objdir *tmp_objdir = tmp_objdir_unapply_primary_odb(); |