aboutsummaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c86
1 files changed, 26 insertions, 60 deletions
diff --git a/environment.c b/environment.c
index a770b5921d..fc3ed8bb1c 100644
--- a/environment.c
+++ b/environment.c
@@ -21,6 +21,7 @@
#include "gettext.h"
#include "git-zlib.h"
#include "ident.h"
+#include "lockfile.h"
#include "mailmap.h"
#include "object-name.h"
#include "repository.h"
@@ -53,7 +54,6 @@ char *git_commit_encoding;
char *git_log_output_encoding;
char *apply_default_whitespace;
char *apply_default_ignorewhitespace;
-char *git_attributes_file;
int zlib_compression_level = Z_BEST_SPEED;
int pack_compression_level = Z_DEFAULT_COMPRESSION;
int fsync_object_files = -1;
@@ -67,7 +67,6 @@ enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
enum eol core_eol = EOL_UNSET;
int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
char *check_roundtrip_encoding;
-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;
#ifndef OBJECT_CREATION_MODE
@@ -75,35 +74,10 @@ enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
#endif
enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
int grafts_keep_true_parents;
-int core_apply_sparse_checkout;
int core_sparse_checkout_cone;
int sparse_expect_files_outside_of_patterns;
int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
unsigned long pack_size_limit_cfg;
-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;
-#elif defined(GIT_WINDOWS_NATIVE) && defined(__clang__) && defined(__aarch64__)
- /*
- * Similar to Visual C, it seems that on Windows/ARM64 the clang-based
- * builds have a smaller stack space available. When running out of
- * that stack space, a `STATUS_STACK_OVERFLOW` is produced. When the
- * Git command was run from an MSYS2 Bash, this unfortunately results
- * in an exit code 127. Let's prevent that by lowering the maximal
- * tree depth; This value seems to be low enough.
- */
- 1280;
-#else
- 2048;
-#endif
#ifndef PROTECT_HFS_DEFAULT
#define PROTECT_HFS_DEFAULT 0
@@ -324,9 +298,11 @@ next_name:
return (current & ~negative) | positive;
}
-static int git_default_core_config(const char *var, const char *value,
- const struct config_context *ctx, void *cb)
+int git_default_core_config(const char *var, const char *value,
+ const struct config_context *ctx, void *cb)
{
+ struct repo_config_values *cfg = repo_config_values(the_repository);
+
/* This needs a better name */
if (!strcmp(var, "core.filemode")) {
trust_executable_bit = git_config_bool(var, value);
@@ -364,8 +340,8 @@ static int git_default_core_config(const char *var, const char *value,
}
if (!strcmp(var, "core.attributesfile")) {
- FREE_AND_NULL(git_attributes_file);
- return git_config_pathname(&git_attributes_file, var, value);
+ FREE_AND_NULL(cfg->attributes_file);
+ return git_config_pathname(&cfg->attributes_file, var, value);
}
if (!strcmp(var, "core.bare")) {
@@ -532,6 +508,11 @@ static int git_default_core_config(const char *var, const char *value,
return 0;
}
+ if (!strcmp(var, "core.lockfilepid")) {
+ lockfile_pid_enabled = git_config_bool(var, value);
+ return 0;
+ }
+
if (!strcmp(var, "core.createobject")) {
if (!value)
return config_error_nonbool(var);
@@ -545,7 +526,7 @@ static int git_default_core_config(const char *var, const char *value,
}
if (!strcmp(var, "core.sparsecheckout")) {
- core_apply_sparse_checkout = git_config_bool(var, value);
+ cfg->apply_sparse_checkout = git_config_bool(var, value);
return 0;
}
@@ -569,11 +550,6 @@ static int git_default_core_config(const char *var, const char *value,
return 0;
}
- if (!strcmp(var, "core.maxtreedepth")) {
- max_allowed_tree_depth = git_config_int(var, value, ctx->kvi);
- return 0;
- }
-
/* Add other config variables here and to Documentation/config.adoc. */
return platform_core_config(var, value, ctx, cb);
}
@@ -607,18 +583,20 @@ static int git_default_i18n_config(const char *var, const char *value)
static int git_default_branch_config(const char *var, const char *value)
{
+ struct repo_config_values *cfg = repo_config_values(the_repository);
+
if (!strcmp(var, "branch.autosetupmerge")) {
if (value && !strcmp(value, "always")) {
- git_branch_track = BRANCH_TRACK_ALWAYS;
+ cfg->branch_track = BRANCH_TRACK_ALWAYS;
return 0;
} else if (value && !strcmp(value, "inherit")) {
- git_branch_track = BRANCH_TRACK_INHERIT;
+ cfg->branch_track = BRANCH_TRACK_INHERIT;
return 0;
} else if (value && !strcmp(value, "simple")) {
- git_branch_track = BRANCH_TRACK_SIMPLE;
+ cfg->branch_track = BRANCH_TRACK_SIMPLE;
return 0;
}
- git_branch_track = git_config_bool(var, value);
+ cfg->branch_track = git_config_bool(var, value);
return 0;
}
if (!strcmp(var, "branch.autosetuprebase")) {
@@ -670,22 +648,6 @@ static int git_default_push_config(const char *var, const char *value)
return 0;
}
-static int git_default_mailmap_config(const char *var, const char *value)
-{
- if (!strcmp(var, "mailmap.file")) {
- FREE_AND_NULL(git_mailmap_file);
- return git_config_pathname(&git_mailmap_file, var, value);
- }
-
- if (!strcmp(var, "mailmap.blob")) {
- FREE_AND_NULL(git_mailmap_blob);
- return git_config_string(&git_mailmap_blob, var, value);
- }
-
- /* Add other config variables here and to Documentation/config.adoc. */
- return 0;
-}
-
static int git_default_attr_config(const char *var, const char *value)
{
if (!strcmp(var, "attr.tree")) {
@@ -720,9 +682,6 @@ int git_default_config(const char *var, const char *value,
if (starts_with(var, "push."))
return git_default_push_config(var, value);
- if (starts_with(var, "mailmap."))
- return git_default_mailmap_config(var, value);
-
if (starts_with(var, "attr."))
return git_default_attr_config(var, value);
@@ -756,3 +715,10 @@ int git_default_config(const char *var, const char *value,
/* Add other config variables here and to Documentation/config.adoc. */
return 0;
}
+
+void repo_config_values_init(struct repo_config_values *cfg)
+{
+ cfg->attributes_file = NULL;
+ cfg->apply_sparse_checkout = 0;
+ cfg->branch_track = BRANCH_TRACK_REMOTE;
+}