{"thread":{"id":"66866","subject":"[PATCH 0/3] Allow merges with results over 2 GiB on 64-bit Windows","startedAt":"2026-11-17T17:43:54Z","lastAt":"2026-11-19T23:50:40Z","messageCount":8,"participants":["Christian Couder","Patrick Steinhardt","Tanga Joris"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"558633","messageId":"20261117174353.1158905-5-christian.couder@gmail.com","threadId":"66866","inReplyTo":null,"subject":"[PATCH 0/3] Allow merges with results over 2 GiB on 64-bit Windows","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2026-11-17T17:43:54Z","receivedAt":"2026-11-17T17:43:54Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Two recent series improved how merge results are sized:\n\n  - `jk/xdiff-size_t` (merged by 81db32ddce) replaced `mmbuffer_t`\n    with `mmfile_t`, whose size is a `size_t` instead of a `long`.\n\n  - `kn/safer-mem-arithmetic-in-xdiff` (merged by 1c93cc03ea) computes\n    the merge buffer size as a `size_t` instead of an `int`, with\n    overflow checks.\n\nAs the latter targets the `maint` branches, which don't have\n`jk/xdiff-size_t`, it also makes `xdl_do_merge()` fail when the result\nis bigger than `LONG_MAX`, so that it cannot be silently truncated\nwhen stored into mmbuffer_t's `long` size on LLP64 platforms like\n64-bit Windows.\n\nOn `master`, that check is not needed for `mmfile_t` anymore, but as\nKaartic pointed out when that series was discussed, merge results were\nstill passed on to a few functions taking an `unsigned long`. This\nseries converts those to `size_t`, and then removes the check.\n\nPatch 1/3 also fixes an existing bug: since c6a4629e32 (odb: use\nsize_t for object_info.sizep and the size APIs, 2026-06-15), a\ndelete/modify conflict in `git notes merge` on a note of 4 GiB or more\nsilently writes a truncated note on LLP64 platforms. That patch could\nbe applied on its own.\n\n## Overview of the patches\n\n  - Patch 1/3 changes the size argument of `write_buf_to_worktree()`\n    in \"notes-merge.c\" from `unsigned long` to `size_t`.\n\n  - Patch 2/3 uses `size_t` for the length argument of\n    `odb_write_object()`, `odb_write_object_ext()`, the\n    `odb_source_write_object()` wrapper and `write_loose_object()`,\n    and for the size stored in `struct inmemory_object`, so that\n    object lengths are not truncated before reaching the already\n    `size_t` backends.\n\n  - Patch 3/3 removes the `size > LONG_MAX` check in `xdl_do_merge()`,\n    lets the `t4300` tests that expect a successful big merge run on\n    LLP64 platforms, and removes the test that expected a failure\n    there.\n\n## Testing\n\nThe code paths changed here only behave differently where `long` is 32\nbits and `size_t` is 64 bits, so Linux and macOS CI cannot exercise\nthem. It would be very nice if someone with a 64-bit Windows setup\ncould run `t4300` with `GIT_TEST_LONG=1`. Beware that it needs enough\nmemory and disk for a merge result just over 4 GiB.\n\n## CI\n\nSome test scripts didn't want to start on MacOS but otherwise all the\ntests passed, see:\n\nhttps://github.com/chriscool/git/actions/runs/44118577071\n\n\nChristian Couder (3):\n  notes-merge: use size_t in write_buf_to_worktree()\n  odb: widen odb_write_object() length to size_t\n  xdiff: drop LONG_MAX check on merge result size\n\n notes-merge.c         |  2 +-\n odb.c                 |  2 +-\n odb.h                 |  4 ++--\n odb/source-inmemory.c |  2 +-\n odb/source-loose.c    |  2 +-\n odb/source.h          |  2 +-\n t/t4300-merge-tree.sh | 13 ++-----------\n xdiff/xmerge.c        |  4 ----\n 8 files changed, 9 insertions(+), 22 deletions(-)\n\n\nbase-commit: e1ec09b23c8e0deb21a0b95ac5996422277395d4\n-- \n2.56.0\n\n\n"},{"id":"558634","messageId":"20261117174353.1158905-6-christian.couder@gmail.com","threadId":"66866","inReplyTo":"20261117174353.1158905-5-christian.couder@gmail.com","subject":"[PATCH 1/3] notes-merge: use size_t in write_buf_to_worktree()","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2026-11-17T17:43:55Z","receivedAt":"2026-11-17T17:43:55Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"The write_buf_to_worktree() function in \"notes-merge.c\" has an\n`unsigned long` size argument, while its two callers from that same\nfile:\n\n1. write_note_to_worktree(), and\n2. ll_merge_in_worktree(),\n\nboth pass a `size_t` to that size argument.\n\nSince c6a4629e32 (odb: use size_t for object_info.sizep and the size\nAPIs, 2026-06-15), the first caller reads the note into a `size_t` size\nbefore passing it on to write_buf_to_worktree(). On LLP64 platforms\nlike 64-bit Windows, where `unsigned long` is 32 bits, a delete/modify\nconflict on a note of 4 GiB or more therefore silently writes a\ntruncated note into NOTES_MERGE_WORKTREE.\n\nThe second caller passes the size of the ll_merge() result, which is a\n`size_t` since 81db32ddce (Merge branch 'jk/xdiff-size_t', 2026-10-15).\nThat size cannot be truncated as since 1c93cc03ea (Merge branch\n'kn/safer-mem-arithmetic-in-xdiff', 2026-10-16), xdl_do_merge() errors\nout if it is greater than LONG_MAX.\n\nBut we want to get rid of that `size > LONG_MAX` check in a following\ncommit.\n\nTo fix the truncation issue with the first caller and to prepare for\ngetting rid of the check, let's convert the size argument in\nwrite_buf_to_worktree() to a `size_t`.\n\nSigned-off-by: Christian Couder <christian.couder@gmail.com>\n---\n notes-merge.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/notes-merge.c b/notes-merge.c\nindex d361e70a48..4b010bcfc0 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -310,7 +310,7 @@ static void check_notes_merge_worktree(struct notes_merge_options *o)\n }\n \n static void write_buf_to_worktree(const struct object_id *obj,\n-\t\t\t\t  const char *buf, unsigned long size)\n+\t\t\t\t  const char *buf, size_t size)\n {\n \tint fd;\n \tchar *path = repo_git_path(the_repository, NOTES_MERGE_WORKTREE \"/%s\", oid_to_hex(obj));\n-- \n2.56.0\n\n\n"},{"id":"558635","messageId":"20261117174353.1158905-7-christian.couder@gmail.com","threadId":"66866","inReplyTo":"20261117174353.1158905-5-christian.couder@gmail.com","subject":"[PATCH 2/3] odb: widen odb_write_object() length to size_t","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2026-11-17T17:43:56Z","receivedAt":"2026-11-17T17:43:56Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"odb_write_object() and odb_write_object_ext() use an `unsigned long`\nfor their object length argument, while almost everything they pass it\nto already uses `size_t`: hash_object_file(), format_object_header(),\nconvert_object_file(), the `write_object` callback of `struct\nodb_source`, and `git_zstream`.\n\nMany callers also pass a `size_t`, often a `strbuf.len`. On LLP64\nplatforms like 64-bit Windows, where `unsigned long` is 32 bits, such\nlengths may silently be truncated.\n\nSince 81db32ddce (Merge branch 'jk/xdiff-size_t', 2026-10-15), the size\nof an ll_merge() result is also passed as a `size_t` to\nodb_write_object(). It cannot be truncated as since 1c93cc03ea (Merge\nbranch 'kn/safer-mem-arithmetic-in-xdiff', 2026-10-16), that size\nargument cannot be greater than LONG_MAX because xdl_do_merge() errors\nout if `size > LONG_MAX`.\n\nBut we want to get rid of that `size > LONG_MAX` check in a following\ncommit.\n\nTo fix the possible truncation issues with many callers and to prepare\nfor getting rid of the check, let's use `size_t` for:\n\n- the length argument of odb_write_object(), odb_write_object_ext(),\n  the odb_source_write_object() wrapper, and write_loose_object(),\n\n- the size stored in `struct inmemory_object`, which is later\n  copied back into `size_t` fields (`object_info.sizep` and\n  `odb_stream.size`).\n\nSigned-off-by: Christian Couder <christian.couder@gmail.com>\n---\n odb.c                 | 2 +-\n odb.h                 | 4 ++--\n odb/source-inmemory.c | 2 +-\n odb/source-loose.c    | 2 +-\n odb/source.h          | 2 +-\n 5 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/odb.c b/odb.c\nindex de5be285d3..56a7910b03 100644\n--- a/odb.c\n+++ b/odb.c\n@@ -702,7 +702,7 @@ void odb_assert_oid_type(struct object_database *odb,\n }\n \n int odb_write_object_ext(struct object_database *odb,\n-\t\t\t const void *buf, unsigned long len,\n+\t\t\t const void *buf, size_t len,\n \t\t\t enum object_type type,\n \t\t\t struct object_id *oid,\n \t\t\t const struct object_id *compat_oid_in,\ndiff --git a/odb.h b/odb.h\nindex 857637f980..a09748bdc2 100644\n--- a/odb.h\n+++ b/odb.h\n@@ -634,14 +634,14 @@ enum odb_write_object_flags {\n  * Returns 0 on success, a negative error code otherwise.\n  */\n int odb_write_object_ext(struct object_database *odb,\n-\t\t\t const void *buf, unsigned long len,\n+\t\t\t const void *buf, size_t len,\n \t\t\t enum object_type type,\n \t\t\t struct object_id *oid,\n \t\t\t const struct object_id *compat_oid,\n \t\t\t enum odb_write_object_flags flags);\n \n static inline int odb_write_object(struct object_database *odb,\n-\t\t\t\t   const void *buf, unsigned long len,\n+\t\t\t\t   const void *buf, size_t len,\n \t\t\t\t   enum object_type type,\n \t\t\t\t   struct object_id *oid)\n {\ndiff --git a/odb/source-inmemory.c b/odb/source-inmemory.c\nindex 75cf29fa9d..c13cffc805 100644\n--- a/odb/source-inmemory.c\n+++ b/odb/source-inmemory.c\n@@ -10,7 +10,7 @@\n struct inmemory_object {\n \tenum object_type type;\n \tconst void *buf;\n-\tunsigned long size;\n+\tsize_t size;\n };\n \n static const struct inmemory_object *find_cached_object(struct odb_source_inmemory *source,\ndiff --git a/odb/source-loose.c b/odb/source-loose.c\nindex 50cb388c35..60801e70e8 100644\n--- a/odb/source-loose.c\n+++ b/odb/source-loose.c\n@@ -758,7 +758,7 @@ static int end_loose_object_common(struct odb_source_loose *loose,\n \n static int write_loose_object(struct odb_source_loose *loose,\n \t\t\t      const struct object_id *oid, char *hdr,\n-\t\t\t      int hdrlen, const void *buf, unsigned long len,\n+\t\t\t      int hdrlen, const void *buf, size_t len,\n \t\t\t      const time_t *mtime, unsigned flags)\n {\n \tint fd, ret;\ndiff --git a/odb/source.h b/odb/source.h\nindex 7b56f51b82..8daf5df31c 100644\n--- a/odb/source.h\n+++ b/odb/source.h\n@@ -454,7 +454,7 @@ static inline int odb_source_freshen_object(struct odb_source *source,\n  * object ID and the compatibility object ID, if non-NULL.\n  */\n static inline int odb_source_write_object(struct odb_source *source,\n-\t\t\t\t\t  const void *buf, unsigned long len,\n+\t\t\t\t\t  const void *buf, size_t len,\n \t\t\t\t\t  enum object_type type,\n \t\t\t\t\t  const struct object_id *oid,\n \t\t\t\t\t  const struct object_id *compat_oid,\n-- \n2.56.0\n\n\n"},{"id":"558636","messageId":"20261117174353.1158905-8-christian.couder@gmail.com","threadId":"66866","inReplyTo":"20261117174353.1158905-5-christian.couder@gmail.com","subject":"[PATCH 3/3] xdiff: drop LONG_MAX check on merge result size","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2026-11-17T17:43:57Z","receivedAt":"2026-11-17T17:43:57Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Since 288266c11d (xdiff: use size_t for merge buffer size computations,\n2026-10-16), a `size > LONG_MAX` check in xdl_do_merge() makes sure the\nsize isn't truncated on LLP64 platforms like 64-bit Windows.\n\nThis check was useful because that `size` was assigned to mmbuffer_t's\nsize which was a `long`. Since 81db32ddce (Merge branch\n'jk/xdiff-size_t', 2026-10-15) though, `mmbuffer_t` has been replaced\nwith `mmfile_t`, which uses `size_t` for its `size` member.\n\nThat size was still passed to odb_write_object() and\nwrite_buf_to_worktree() that accepted `unsigned long` arguments, but\nprevious commits have changed the types of those arguments to `size_t`.\nSo the `size > LONG_MAX` check in xdl_do_merge() is not preventing any\ntruncation anymore.\n\nLet's then get rid of this `size > LONG_MAX` check and allow sizes as\nbig as `size_t` allows, so that merges with results over 2 GiB no\nlonger fail on 64-bit Windows.\n\nThis also allows us to clean up related tests in \"t4300-merge-tree.sh\".\n\nNote that overflows in the size computation itself, for example when\n`size_t` is 32 bits, are still caught by the st_add*() calls added by\nb1313872ce (xdiff: check for overflow when computing merge buffer size,\n2026-10-16).\n\nSigned-off-by: Christian Couder <christian.couder@gmail.com>\n---\n t/t4300-merge-tree.sh | 13 ++-----------\n xdiff/xmerge.c        |  4 ----\n 2 files changed, 2 insertions(+), 15 deletions(-)\n\ndiff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh\nindex 41386d6025..54bf6c0327 100755\n--- a/t/t4300-merge-tree.sh\n+++ b/t/t4300-merge-tree.sh\n@@ -430,15 +430,13 @@ test_expect_success EXPENSIVE 'setup: base commit with attributes' '\n \tgit commit -a -m side2\n '\n \n-# We have LONG_IS_64BIT as a prerequisite since we guard against downcasts\n-# from 64-bit size_t to 32-bit long (for example on Windows)\n-test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,LONG_IS_64BIT 'no buffer overflow in merge-tree --write-tree' '\n+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'no buffer overflow in merge-tree --write-tree' '\n \ttest_expect_code 1 git merge-tree --write-tree side1 side2 >out &&\n \ttree=$(head -n 1 out) &&\n \tgit cat-file -e \"$tree^{tree}\"\n '\n \n-test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,LONG_IS_64BIT 'conflicted paths are listed without buffer overflow' '\n+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'conflicted paths are listed without buffer overflow' '\n \ttest_expect_code 1 git merge-tree --write-tree --name-only \\\n \t\tside1 side2 >out &&\n \tsed -n \"2,\\$p\" out | sed \"/^\\$/,\\$d\" | sort -u >actual &&\n@@ -449,13 +447,6 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,LONG_IS_64BIT 'conflicted paths ar\n \ttest_cmp expect actual\n '\n \n-# Ensure we properly identify a downcast from 64-bit size_t to\n-# 32-bit long on Windows\n-test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT 'merge-tree dies when merge buffer size does not fit long' '\n-\ttest_must_fail git merge-tree --write-tree side1 side2 2>err &&\n-\ttest_grep \"failure to merge\" err\n-'\n-\n test_expect_success EXPENSIVE,!SIZE_T_IS_64BIT 'merge-tree dies when merge buffer size overflows size_t' '\n \ttest_must_fail git merge-tree --write-tree side1 side2 2>err &&\n \ttest_grep \"size_t overflow\" err\ndiff --git a/xdiff/xmerge.c b/xdiff/xmerge.c\nindex 5a78b88fad..2ef9c049e5 100644\n--- a/xdiff/xmerge.c\n+++ b/xdiff/xmerge.c\n@@ -669,10 +669,6 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1,\n \t\t\t\t\t\t    ancestor_name,\n \t\t\t\t\t\t    favor, changes, NULL, style,\n \t\t\t\t\t\t    marker_size);\n-\t\tif (size > LONG_MAX) {\n-\t\t\txdl_cleanup_merge(changes);\n-\t\t\treturn -1;\n-\t\t}\n \t\tresult->ptr = xdl_malloc(size);\n \t\tif (!result->ptr) {\n \t\t\txdl_cleanup_merge(changes);\n-- \n2.56.0\n\n\n"},{"id":"558681","messageId":"av1g1O5AG7wR7tjb@pks.im","threadId":"66866","inReplyTo":"20261117174353.1158905-6-christian.couder@gmail.com","subject":"Re: [PATCH 1/3] notes-merge: use size_t in write_buf_to_worktree()","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-18T08:25:09Z","receivedAt":"2026-11-18T08:25:09Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Nov 17, 2026 at 06:43:55PM +0100, Christian Couder wrote:\n> The write_buf_to_worktree() function in \"notes-merge.c\" has an\n> `unsigned long` size argument, while its two callers from that same\n> file:\n> \n> 1. write_note_to_worktree(), and\n> 2. ll_merge_in_worktree(),\n> \n> both pass a `size_t` to that size argument.\n> \n> Since c6a4629e32 (odb: use size_t for object_info.sizep and the size\n> APIs, 2026-06-15), the first caller reads the note into a `size_t` size\n> before passing it on to write_buf_to_worktree(). On LLP64 platforms\n> like 64-bit Windows, where `unsigned long` is 32 bits, a delete/modify\n> conflict on a note of 4 GiB or more therefore silently writes a\n> truncated note into NOTES_MERGE_WORKTREE.\n\nHeh, this feels like nobody would ever hit such an issue. But fixing it\nis the right thing regardless of that, of course.\n\n[snip]\n> To fix the truncation issue with the first caller and to prepare for\n> getting rid of the check, let's convert the size argument in\n> write_buf_to_worktree() to a `size_t`.\n\nMakes sense. I've been lamenting about that before, but I really wish\nthat C wasn't so painful to work with in this area. All these implicit\ncasts are just so error-prone.\n\n> diff --git a/notes-merge.c b/notes-merge.c\n> index d361e70a48..4b010bcfc0 100644\n> --- a/notes-merge.c\n> +++ b/notes-merge.c\n> @@ -310,7 +310,7 @@ static void check_notes_merge_worktree(struct notes_merge_options *o)\n>  }\n>  \n>  static void write_buf_to_worktree(const struct object_id *obj,\n> -\t\t\t\t  const char *buf, unsigned long size)\n> +\t\t\t\t  const char *buf, size_t size)\n>  {\n>  \tint fd;\n>  \tchar *path = repo_git_path(the_repository, NOTES_MERGE_WORKTREE \"/%s\", oid_to_hex(obj));\n\nLooks obviously correct to me. We pass the value to `write_in_full()`,\nwhich already accepts a `size_t` as input parameter.\n\nPatrick\n\n"},{"id":"558682","messageId":"av1g7VQnCAcs5J1W@pks.im","threadId":"66866","inReplyTo":"20261117174353.1158905-7-christian.couder@gmail.com","subject":"Re: [PATCH 2/3] odb: widen odb_write_object() length to size_t","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-18T08:25:17Z","receivedAt":"2026-11-18T08:25:17Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Nov 17, 2026 at 06:43:56PM +0100, Christian Couder wrote:\n> odb_write_object() and odb_write_object_ext() use an `unsigned long`\n> for their object length argument, while almost everything they pass it\n> to already uses `size_t`: hash_object_file(), format_object_header(),\n> convert_object_file(), the `write_object` callback of `struct\n> odb_source`, and `git_zstream`.\n\nHuh, I thought that we already had patches recently that converted this\nfunction to use `size_t`... oh, yes, this is overlapping with Elia's\npatch series [1]. I think it would make sense to rebase your patch\nseries on top of his patches.\n\n[1]: <20261021101640.329990-1-gitter.spiros@gmail.com>\n\n[snip]\n> To fix the possible truncation issues with many callers and to prepare\n> for getting rid of the check, let's use `size_t` for:\n> \n> - the length argument of odb_write_object(), odb_write_object_ext(),\n>   the odb_source_write_object() wrapper, and write_loose_object(),\n> \n> - the size stored in `struct inmemory_object`, which is later\n>   copied back into `size_t` fields (`object_info.sizep` and\n>   `odb_stream.size`).\n\nYeah, makes sense.\n\n> diff --git a/odb.c b/odb.c\n> index de5be285d3..56a7910b03 100644\n> --- a/odb.c\n> +++ b/odb.c\n> @@ -702,7 +702,7 @@ void odb_assert_oid_type(struct object_database *odb,\n>  }\n>  \n>  int odb_write_object_ext(struct object_database *odb,\n> -\t\t\t const void *buf, unsigned long len,\n> +\t\t\t const void *buf, size_t len,\n>  \t\t\t enum object_type type,\n>  \t\t\t struct object_id *oid,\n>  \t\t\t const struct object_id *compat_oid_in,\n\nRight. All functions that we pass `len` to already accept a `size_t`,\nexcept for `odb_source_write_object()`. But you also adapt that function\nat the same time, so we're good.\n\n> diff --git a/odb/source.h b/odb/source.h\n> index 7b56f51b82..8daf5df31c 100644\n> --- a/odb/source.h\n> +++ b/odb/source.h\n> @@ -454,7 +454,7 @@ static inline int odb_source_freshen_object(struct odb_source *source,\n>   * object ID and the compatibility object ID, if non-NULL.\n>   */\n>  static inline int odb_source_write_object(struct odb_source *source,\n> -\t\t\t\t\t  const void *buf, unsigned long len,\n> +\t\t\t\t\t  const void *buf, size_t len,\n>  \t\t\t\t\t  enum object_type type,\n>  \t\t\t\t\t  const struct object_id *oid,\n>  \t\t\t\t\t  const struct object_id *compat_oid,\n\nAnd the callback functions fo the backend already use a `size_t`, so\nthose don't need to be changed.\n\nPatrick\n\n"},{"id":"558683","messageId":"CAP8UFD2CLGe_ip1EPWvq+Es51ROzupiFZgJFuNVpLHrFQSUK+g@mail.gmail.com","threadId":"66866","inReplyTo":"av1g7VQnCAcs5J1W@pks.im","subject":"Re: [PATCH 2/3] odb: widen odb_write_object() length to size_t","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2026-11-18T09:17:04Z","receivedAt":"2026-11-18T09:17:04Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Wed, Nov 18, 2026 at 9:25 AM Patrick Steinhardt <ps@pks.im> wrote:\n\n> Huh, I thought that we already had patches recently that converted this\n> function to use `size_t`... oh, yes, this is overlapping with Elia's\n> patch series [1]. I think it would make sense to rebase your patch\n> series on top of his patches.\n>\n> [1]: <20261021101640.329990-1-gitter.spiros@gmail.com>\n\nYeah, I overlooked that series. I will rebase on top of it.\n\nThanks.\n\n"},{"id":"558902","messageId":"CAKrRMNqMRkkb9+n+11p04YDhn6p39uoc_Upc9voYhZZoLyPXBA@mail.gmail.com","threadId":"66866","inReplyTo":"20261117174353.1158905-8-christian.couder@gmail.com","subject":"Re: [PATCH 3/3] xdiff: drop LONG_MAX check on merge result size","fromName":"Tanga Joris","fromEmail":"tangajoris@gmail.com","sentAt":"2026-11-19T23:50:40Z","receivedAt":"2026-11-19T23:50:40Z","isPatch":true,"sender":{"key":"tangajoris@gmail.com","avatar":null},"body":"Hello Christian,\n\nGreat work with the series.\n\nOn Tue, 17 Nov 2026 at 20:46, Christian Couder\n<christian.couder@gmail.com> wrote:\n> Let's then get rid of this `size > LONG_MAX` check and allow sizes as\n> big as `size_t` allows, so that merges with results over 2 GiB no\n> longer fail on 64-bit Windows.\n\nI ran t4300 with GIT_TEST_LONG=1 on a Windows server runner on GitHub Actions,\nas you requested in the cover letter:\n\nhttps://github.com/tmjoris/git/actions/runs/44423166965\n\nOn e1ec09b23c, the two big merge tests are skipped, because long is 32\nbits there. \"merge-tree dies when merge buffer size does not fit long\"\npasses. With the series on top, both big merge tests pass.\n\nI also ran it natively on a Windows laptop with the Git SDK, and got similar\nresults.\n\nI went through the other callers of ll_merge() and xdl_merge(), to see\nif any of them still pass the result through an unsigned long. They\nall end up in odb_write_object(), write_buf_to_worktree(),\nstrbuf_attach() or fwrite(), which all take a size_t with this series.\nSo I agree the check is not needed anymore.\n\nLooks good to me.\n\nThanks,\nTanga\n\n"}]}