Skip to content

Commit 55f95ed

Browse files
committed
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
2 parents 8be77c5 + b64d78a commit 55f95ed

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

environment.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,20 @@ int merge_log_config = -1;
8181
int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
8282
unsigned long pack_size_limit_cfg;
8383
enum log_refs_config log_all_ref_updates = LOG_REFS_UNSET;
84-
int max_allowed_tree_depth = 2048;
84+
int max_allowed_tree_depth =
85+
#ifdef _MSC_VER
86+
/*
87+
* When traversing into too-deep trees, Visual C-compiled Git seems to
88+
* run into some internal stack overflow detection in the
89+
* `RtlpAllocateHeap()` function that is called from within
90+
* `git_inflate_init()`'s call tree. The following value seems to be
91+
* low enough to avoid that by letting Git exit with an error before
92+
* the stack overflow can occur.
93+
*/
94+
512;
95+
#else
96+
2048;
97+
#endif
8598

8699
#ifndef PROTECT_HFS_DEFAULT
87100
#define PROTECT_HFS_DEFAULT 0

0 commit comments

Comments
 (0)