]> git.ipfire.org Git - thirdparty/git.git/blobdiff - environment.c
git: extend --no-lazy-fetch to work across subprocesses
[thirdparty/git.git] / environment.c
index bb3c2a96a33445c6fddb41e5ac02df2b3a88c442..0ae5bbd4a185410a5dc3605cde193a0e9ad73006 100644 (file)
@@ -81,7 +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 = 2048;
+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
@@ -194,6 +207,9 @@ void setup_git_env(const char *git_dir)
        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)