From: Patrick Steinhardt <ps@pks.im>
To: "René Scharfe" <l.s.r@web.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 01/10] environment: move access to core.maxTreeDepth into repo settings
Date: Mon, 12 Jan 2026 10:21:40 +0100 [thread overview]
Message-ID: <aWS9JLb3UyxOwg9Z@pks.im> (raw)
In-Reply-To: <20260109213021.2546-2-l.s.r@web.de>
On Fri, Jan 09, 2026 at 10:30:12PM +0100, René Scharfe wrote:
> diff --git a/git-compat-util.h b/git-compat-util.h
> index b0673d1a450..bebcf9f698c 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -578,6 +578,30 @@ static inline bool strip_suffix(const char *str, const char *suffix,
> #define DEFAULT_PACKED_GIT_LIMIT \
> ((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? (32 * 1024L * 1024L) : 256))
>
> +#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.
> + */
> +#define DEFAULT_MAX_ALLOWED_TREE_DEPTH 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.
> + */
> +#define DEFAULT_MAX_ALLOWED_TREE_DEPTH 1280
> +#else
> +#define DEFAULT_MAX_ALLOWED_TREE_DEPTH 2048
> +#endif
> +
> int git_open_cloexec(const char *name, int flags);
> #define git_open(name) git_open_cloexec(name, O_RDONLY)
>
Why is this new constant defined in "git-compat-util.h"? That feels way
too global for my taste for a value that should ultimately only be
required by "repo-settings.c". Is there a reason why it's not declared
in "repo-settings.h"?
I think we could even get away with declaring it in "repo-settings.c".
The expectation is that the settings need to be prepared anyway, so we
can simply set up the default when parsing the config.
Patrick
next prev parent reply other threads:[~2026-01-12 9:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 21:30 [PATCH 00/10] tree: stop using the_repository René Scharfe
2026-01-09 21:30 ` [PATCH 01/10] environment: move access to core.maxTreeDepth into repo settings René Scharfe
2026-01-12 9:21 ` Patrick Steinhardt [this message]
2026-01-12 19:37 ` René Scharfe
2026-01-09 21:30 ` [PATCH 02/10] tree: add repo_parse_tree*() René Scharfe
2026-01-09 21:30 ` [PATCH 03/10] add-interactive: use repo_parse_tree_indirect() René Scharfe
2026-01-09 21:30 ` [PATCH 04/10] bloom: use repo_parse_tree() René Scharfe
2026-01-09 21:30 ` [PATCH 05/10] delta-islands: " René Scharfe
2026-01-09 21:30 ` [PATCH 06/10] pack-bitmap-write: " René Scharfe
2026-01-09 21:30 ` [PATCH 07/10] path-walk: use repo_parse_tree_gently() René Scharfe
2026-01-09 21:30 ` [PATCH 08/10] tree: use repo_parse_tree() René Scharfe
2026-01-12 9:21 ` Patrick Steinhardt
2026-01-09 21:30 ` [PATCH 09/10] tree: stop using the_repository René Scharfe
2026-01-12 9:21 ` Patrick Steinhardt
2026-01-12 14:22 ` Junio C Hamano
2026-01-12 15:00 ` Patrick Steinhardt
2026-01-12 15:17 ` Junio C Hamano
2026-01-12 15:20 ` Junio C Hamano
2026-01-12 15:28 ` Patrick Steinhardt
2026-01-12 19:37 ` René Scharfe
2026-01-13 6:13 ` Patrick Steinhardt
2026-01-09 21:30 ` [PATCH 10/10] cocci: convert parse_tree functions to repo_ variants René Scharfe
2026-01-15 22:01 ` [PATCH 11/10] cocci: remove obsolete the_repository rules René Scharfe
2026-01-16 10:02 ` Patrick Steinhardt
2026-01-16 17:28 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aWS9JLb3UyxOwg9Z@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox