summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-11-08 11:03:58 +0900
committerJunio C Hamano <gitster@pobox.com>2023-11-08 11:03:58 +0900
commit55f95ed8ac8d500f52349927b86f7474138f1ad0 (patch)
tree0fbe870a57dd83118419d5dd188c0cb17dfede02
parent8be77c5de65442b331a28d63802c7a3b94a06c5a (diff)
parentb64d78ad02ca14ab4d658a1055f43f8edf5e3990 (diff)
downloadgit-55f95ed8ac8d500f52349927b86f7474138f1ad0.tar.gz
Merge branch 'jk/tree-name-and-depth-limit'
Further limit tree depth max to avoid Windows build running out of the stack space. * jk/tree-name-and-depth-limit: max_tree_depth: lower it for MSVC to avoid stack overflows
-rw-r--r--environment.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/environment.c b/environment.c
index bb3c2a96a3..9e37bf58c0 100644
--- a/environment.c
+++ b/environment.c
@@ -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