Commit Graph

178473 Commits

Author SHA1 Message Date
Matthias Aßhauer
a1d0874a64 win32: thread-utils: handle multi-socket systems
While the currently used way to detect the number of CPU cores on
Windows is nice and straight-forward, GetSystemInfo() only gives us
access to the number of processors within the current group. [1]

While that is usually fine for systems with a single physical CPU,
separate physical sockets are typically separate groups.

Switch to using GetLogicalProcessorInformationEx() to handle multi-socket
systems better.

[1] https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info#members

This fixes https://github.com/git-for-windows/git/issues/4766

Co-Authored-by: Herman Semenov <GermanAizek@yandex.ru>
Signed-off-by: Matthias Aßhauer <mha1993@live.de>
2026-06-23 19:45:20 +02:00
Johannes Schindelin
eb62973d67 Merge branch 'fixes-from-the-git-mailing-list'
These fixes have been sent to the Git mailing list but have not been
picked up by the Git project yet.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:45:17 +02:00
Johannes Schindelin
dc99cb55dc Merge branch 'v2.53.0.windows.3'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:43:51 +02:00
Jeff King
72e58d2478 grep: prevent ^$ false match at end of file
In some implementations, `regexec_buf()` assumes that it is fed lines;
Without `REG_NOTEOL` it thinks the end of the buffer is the end of a
line. Which makes sense, but trips up this case because we are not
feeding lines, but rather a whole buffer. So the final newline is not
the start of an empty line, but the true end of the buffer.

This causes an interesting bug:

  $ echo content >file.txt
  $ git grep --no-index -n '^$' file.txt
  file.txt:2:

This bug is fixed by making the end of the buffer consistently the end
of the final line.

The patch was applied from
https://lore.kernel.org/git/20250113062601.GD767856@coredump.intra.peff.net/

Reported-by: Olly Betts <olly@survex.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:43:51 +02:00
Johannes Schindelin
f331752679 unix-socket: avoid leak when initialization fails
When a Unix socket is initialized, the current directory's path is
stored so that the cleanup code can `chdir()` back to where it was
before exit.

If the path that needs to be stored exceeds the default size of the
`sun_path` attribute of `struct sockaddr_un` (which is defined as a
108-sized byte array on Linux), a larger buffer needs to be allocated so
that it can hold the path, and it is the responsibility of the
`unix_sockaddr_cleanup()` function to release that allocated memory.

In Git's CI, this stack allocation is not necessary because the code is
checked out to `/home/runner/work/git/git`. Concatenate the path
`t/trash directory.t0301-credential-cache/.cache/git/credential/socket`
and a terminating NUL, and you end up with 96 bytes, 12 shy of the
default `sun_path` size.

However, I use worktrees with slightly longer paths:
`/home/me/projects/git/yes/i/nest/worktrees/to/organize/them/` is more
in line with what I have. When I recently tried to locally reproduce a
failure of the `linux-leaks` CI job, this t0301 test failed (where it
had not failed in CI).

The reason: When `credential-cache` tries to reach its daemon initially
by calling `unix_sockaddr_init()`, it is expected that the daemon cannot
be reached (the idea is to spin up the daemon in that case and try
again). However, when this first call to `unix_sockaddr_init()` fails,
the code returns early from the `unix_stream_connect()` function
_without_ giving the cleanup code a chance to run, skipping the
deallocation of above-mentioned path.

The fix is easy: do not return early but instead go directly to the
cleanup code.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:43:51 +02:00
Johannes Schindelin
a400535d70 Merge branch 'prevent-accidental-ntlm-exfiltration-via-symlinks'
This merges the fix for CVE-2026-32631 into the v2.53.x release branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:43:09 +02:00
Johannes Schindelin
b9cf4807d6 Start the merging-rebase to v2.55.0-rc2
This commit starts the rebase of 7516df929c to 645f6c080f93
2026-06-23 19:43:09 +02:00
Johannes Schindelin
6fb185e604 Merge branch 'fix-ci'
This fixes two issues, one specific to running CI for embargoed releases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:43:09 +02:00
Johannes Schindelin
ec2c315983 mingw: skip symlink type auto-detection for network share targets
On Windows, symbolic links come in two flavors: file symlinks and
directory symlinks.  Since Git was born on Linux where this distinction
does not exist, Git for Windows has to auto-detect the type by looking
at the target.  When the target does not yet exist at symlink creation
time, Git for Windows creates a "phantom" file symlink and later, once
checkout is complete, calls `CreateFileW()` on the target to check
whether it is actually a directory.

If the symlink target is a UNC path (e.g. `\\attacker\share`), this
auto-detection triggers an SMB connection to the remote host.  Windows
performs NTLM authentication by default for such connections, which
means a crafted repository can exfiltrate the cloning user's NTLMv2
hash to an attacker-controlled server without any user interaction
beyond `git clone -c core.symlinks=true <url>`.

There are ways to specify UNC paths that start with only a single
backslash (e.g. `\??\UNC\host\share`); All of them do start like
that, though, so let's use that as a tell-tale that we should skip
the auto-detection in `process_phantom_symlink()`. The symlink is
then left as a file symlink (the `mklink` default), and a warning is
emitted suggesting the user set the `symlink` gitattribute to `dir`
if a directory symlink is needed.  When the attribute is already set,
auto-detection is never invoked in the first place, so that code path
is unaffected.

This is the same class of vulnerability as CVE-2025-66413
(https://github.com/git-for-windows/git/security/advisories/GHSA-hv9c-4jm9-jh3x)
and follows the same general mitigation pattern that MinTTY adopted for
ANSI escape sequences referencing network share paths
(https://github.com/mintty/mintty/security/advisories/GHSA-jf4m-m6rv-p6c5).

Note that there are legitimate paths starting with a single backslash
that are _not_ network paths: drive-less absolute paths are interpreted
as relative to the current working directory's drive. In practice, these
are highly uncommon (and brittle, just one working directory change
away from breaking). In any case, the only consequence is now that the
symlink type of those has to be specified via Git attributes, is all.

Reported-by: Justin Lee <jessdhoctor@gmail.com>
Addresses: CVE-2026-32631
Addresses: https://github.com/git-for-windows/git/security/advisories/GHSA-9j5h-h4m7-85hx
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:43:09 +02:00
Johannes Schindelin
263c5a155b ci(dockerized): reduce the PID limit for private repositories
Every once in a while I need to verify that Microsoft Git's test suite
passes for changes that are not yet meant for public consumption, and
since it was (made) too difficult to keep up a working Azure Pipeline
definition, I have to use GitHub Actions in a private GitHub repository
for that purpose.

In these tests, basically all Dockerized CI jobs fail consistently. The
symptom is something like:

  error: cannot create async thread: Resource temporarily unavailable

in the middle of a test, typically in the t5xxx-t6xxx range. The first
such error is immediately followed by plenty more of these errors, and
not a single test succeeds afterwards.

At first, I thought that maybe the massive parallelism I enjoy there is
the problem, and I thought that the cgroups limits might be shared
between the many containers that run on essentially the same physical
machine. But even reducing the matrix to just a single of those
Dockerized jobs runs into the very same problems.

The underlying reason seems to be a substantial difference in the hosted
runners that execute these Dockerized jobs: forcing the PID limit of the
container to a high number lets the jobs pass, even when running the
complete matrix of all 13 Dockerized jobs concurrently. But that's not
the only difference: The jobs seem to take a lot longer in these
containers than, say, in the containers made available to
https://github.com/git/git.

When forcing a PID limit of 64k in that private repository, the jobs
completed successfully, but they also took a lot longer, between 2x to
2.5x longer, i.e. painfully much longer. Reducing the PID limit to 16k,
the CI jobs still passed, but took an equally long amount of time.
Reducing the PID limit to 8k caused the errors to reappear.

Here are the numbers from three example runs, the first one forcing the
PID and nproc limit to 65536, the second one to 16384, the third run is
from the public git/git repository:

Job                           | 64k     | 16k     | reference
------------------------------|---------|---------|---------
almalinux-8                   | 19m 3s  | 16m 0s  | 9m 36s
debian-11                     | 20m 31s | 20m 3s  | 8m 5s
fedora-breaking-changes-meson | 16m 29s | 19m 19s | 9m 40s
linux-asan-ubsan              | 1h 10m  | 1h 11m  | 34m 36s
linux-breaking-changes        | 25m 39s | 25m 58s | 13m 15s
linux-leaks                   | 1h 9m   | 1h 10m  | 33m 30s
linux-meson                   | 28m 9s  | 27m 4s  | 13m 45s
linux-musl-meson              | 16m 32s | 13m 39s | 8m 6s
linux-reftable-leaks          | 1h 13m  | 1h 13m  | 34m 34s
linux-reftable                | 26m 2s  | 25m 48s | 13m 31s
linux-sha256                  | 26m 12s | 26m 3s  | 12m 36s
linux-TEST-vars               | 26m 5s  | 25m 21s | 13m 25s
linux32                       | 21m 16s | 19m 57s | 10m 44s

It does not look as if the PID limit is the reason for the longer
runtime, seeing as the 64k vs 16k timings deviate no more than as is
usual with GitHub workflows. So let's go for 16k.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:43:09 +02:00
Johannes Schindelin
1a38c3ce78 Merge branch 'dependabot/github_actions/actions/checkout-7'
This merges https://github.com/git-for-windows/git/pull/6290.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:41:25 +02:00
Johannes Schindelin
6110719705 Merge branch 'skip-rust-in-the-coverity-builds'
This branch fixes the `coverity` workflow after the Rust part of Git's
build has turned from opt-in to opt-out.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 19:34:29 +02:00
Johannes Schindelin
25e5184f0d Continue improving support for 4GB+ packs/clones/objects (#6289)
This PR contains a branch thicket on top of v2.55.0-rc1 (i.e. ready to
go upstream) to continue the bulk of the `unsigned long` -> `size_t`
transformation.

Since all of these changes have no impact on the currently-working
functionality for <4GB objects/packs/clones (modulo bugs, that is 😄), I
would like to merge this before v2.55.0-rc2, still: The risk of
introducing a regression is negligible, the chance for fixing the
majority of problems with large clones is high.
2026-06-23 18:19:48 +02:00
Johannes Schindelin
c08f978758 fixup! mingw: support long paths
Coverity reported that the new `mingw_rename()` function may overrun the
`FileName` buffer if using a long path.

The reason is that I forgot to adjust it for long path support, and
while looking at this, I realized that I also had forgotten to adjust
`mingw_strbuf_realpath()` and `is_path_owned_by_current_sid()`, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 18:11:48 +02:00
Johannes Schindelin
3dd68af1c1 coverity: skip building with Rust, for now
CI runs in GitHub Actions runners are ill-equipped to build with Rust,
as the Windows/GCC-compatible toolchain isn't set up.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-23 14:50:25 +02:00
Johannes Schindelin
6e33d54072 AGENTS.md: document non-interactive builds (MSYSTEM, NO_RUST) (#6288)
This is a small documentation improvement to `AGENTS.md`. The current
"Building and Testing" section only shows `make -j15` "in a Git for
Windows SDK shell" and says nothing about how to drive the build when
you are not sitting in an interactive SDK shell, for example from
PowerShell or from an automation agent. These are two things that are
easy to get wrong in that situation, so let's write them down.

The first is that a login shell is the wrong tool: `bash -l` / `bash
--login` re-runs the profile scripts and is unnecessary once `MSYSTEM`
and `PATH` are set explicitly. Setting `MSYSTEM=MINGW64` and prepending
the SDK's `mingw64\bin` and `usr\bin` directories to `PATH`, then
invoking a non-login `bash -c`, is enough to get a working build
environment. The second is that when the optional Rust component fails
to link (`cannot find target/release/libgitcore.a`), passing `NO_RUST=1`
skips the cargo step.

This is expressed as a `fixup!` for the commit that introduced
`AGENTS.md`, so that it autosquashes into that commit during the next
merging-rebase rather than adding a separate entry to the branch
thicket.
2026-06-23 11:40:07 +02:00
Junio C Hamano
ab776a62a7 Git 2.55-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-22 20:05:04 -07:00
Junio C Hamano
1ea786d14a Merge branch 'hn/macos-linker-warning'
Xcode 15 and later has a linker set to complain when the same library
archive is listed twice on the command line.  Squelch the annoyance.

* hn/macos-linker-warning:
  config.mak.uname: avoid macOS dup-library warning
2026-06-22 20:05:04 -07:00
Junio C Hamano
b0dcf92387 Merge branch 'js/win32-localtime-r'
Build-fix for 32-bit Windows.

* js/win32-localtime-r:
  win32: ensure that `localtime_r()` is declared even in i686 builds
2026-06-22 20:05:04 -07:00
Junio C Hamano
5d7df01d2e Merge branch 'ps/gitlab-ci-windows'
Wean the Windows builds in GitLab CI procedure away from
(unfortunately unreliable) Chocolatey to install dependencies.

* ps/gitlab-ci-windows:
  gitlab-ci: migrate Windows builds away from Chocolatey
2026-06-22 20:05:03 -07:00
dependabot[bot]
2549429ba3 build(deps): bump actions/checkout from 6 to 7
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-22 20:32:58 +00:00
Johannes Schindelin
b391157a49 Merge branch 'topic/size-t-followups' (size_t followups depending on seen topics) 2026-06-22 17:42:28 +02:00
Johannes Schindelin
38d20543f7 Merge branch 'topic/size-t' (size_t evacuation, upstream-bound) 2026-06-22 17:42:28 +02:00
Johannes Schindelin
bd09298afc Drop the cast_size_t_to_ulong() helper
Now that all of the call sites of this helper (which I used as a kind of
"NEEDSWORK" marker) are eliminated, we can drop that helper altogether.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:28 +02:00
Johannes Schindelin
3796065a3d t/helper/test-pack-deltas: drop the delta_size cast in write_ref_delta()
Tidies up the bridge variable introduced in the create_delta() /
diff_delta() widening commit earlier in this series. With the test
helper's local do_compress() also widened to size_t in pass, the
narrowing into the unsigned long delta_size local that compress
expected is gone, the size_st bridge is unnecessary, and the cast
goes away. encode_in_pack_object_header() takes uintmax_t and
hashwrite() takes uint32_t, both unchanged.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:28 +02:00
Johannes Schindelin
e9aa08fde6 fast-import: drop the six size casts in the object-read paths
Continue the size_t evacuation. fast-import's helper
gfi_unpack_entry() and the five size-handling sites that feed off
it (store_object()'s deltalen, load_tree(), parse_from_existing(),
the inline gfi_unpack_entry() caller in parse_objectish(),
cat_blob(), and dereference()) all carry size_t-shaped values from
the odb / unpack_entry() APIs through cast_size_t_to_ulong()
bridges into unsigned long locals.

With the producers (odb_read_object(), odb_read_object_peeled(),
unpack_entry()) and the consumers it feeds (the zlib avail_in
field from a prior commit, encode_in_pack_object_header()'s
uintmax_t parameter, parse_from_commit()'s widened size parameter)
all size_t-ready, the bridges and casts go away in one pass.
gfi_unpack_entry() now writes into the caller's size_t directly,
and the six locals collapse to plain size_t declarations.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:28 +02:00
Johannes Schindelin
8849de1945 blame: widen struct blame_scoreboard.final_buf_size to size_t
Continue the size_t evacuation. final_buf_size is fed either from
textconv_object()'s now-size_t out-parameter, from
odb_read_object()'s size_t out-parameter (both bridged today
through a final_buf_size_st local + cast_size_t_to_ulong()), or
from o->file.size (mmfile_t, long). Widen the struct field, point
both producers straight at it, and drop the bridge variable along
with the cast.

builtin/blame.c only reads the field for pointer arithmetic and
comparisons, which promote cleanly.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:28 +02:00
Johannes Schindelin
069ff038f7 pack-objects: drop the last size shim in write_no_reuse_object()
Continue the size_t evacuation that this series and the merged
js/objects-larger-than-4gb-on-windows topic are advancing for
>4 GiB objects on Windows: with the odb readers and the zlib
helpers reached from do_compress() now widened end-to-end, the
last cast_size_t_to_ulong() shim in this function can be removed,
and do_compress() itself can carry the new size type through.

Two cast_size_t_to_ulong() shims remain in this file; they feed
the tree-walk API, which is still narrow and is a separate
widening topic.

write_no_reuse_object()'s return type and the hashfile API are
still narrow but unchanged in observable behaviour: on 64-bit
Linux ulong coincides with size_t, and on Windows these were the
narrow fenceposts the prior topics deliberately left in place.
Their widening is left to follow-ups touching the hashfile API
and the write_object() caller chain.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:28 +02:00
Johannes Schindelin
0ba41b5536 pack-objects: drop cast_size_t_to_ulong shims in try_delta()
Companion to the prior get_delta() cleanup, and the last try_delta()
piece of the >4 GiB delta-path topic. Every consumer that the
function's locals fed has now been widened: SIZE() / DELTA_SIZE() to
size_t (prior topic), the mem_usage out-parameter and delta_cacheable()
earlier in this series, and create_delta() / create_delta_index() in
the immediately preceding commits.

Widen the declaration of trg_size, src_size, sizediff, max_size and
sz to size_t (delta_size joins them on the same line, removing the
size_t delta_size line that the create_delta() widening commit added
as a stop-gap), and drop the two sz_st bridge variables together with
the surrounding cast_size_t_to_ulong() calls. The result is just
"odb_read_object(&sz)" on both reads.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:28 +02:00
Johannes Schindelin
783a88ba89 pack-objects: drop cast_size_t_to_ulong shims in get_delta()
The two shims that 606c192380 (odb, packfile: use size_t for
streaming object sizes, 2026-05-08) and the subsequent
odb_read_object() widening introduced as scaffolding around
get_delta()'s reads can now disappear: the previous commit widened
diff_delta() to size_t, which was the last narrow consumer in this
function.

Widen size and base_size to size_t outright, drop the size_st /
base_size_st bridging temporaries, and drop the two
cast_size_t_to_ulong() calls. Net change is 4 lines smaller and one
read-then-cast indirection gone from each odb read.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:28 +02:00
Johannes Schindelin
b3f6155e94 Merge branch 'topic/size-t' into size-t-followups 2026-06-22 17:42:28 +02:00
Johannes Schindelin
80cb370aef Merge branch 'size-t/unpack-objects' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
6e9281fc3f Merge branch 'size-t/repo' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
e1d07a76fe Merge branch 'size-t/fast-export' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
1f77de2c86 Merge branch 'size-t/grep' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
d88b9b0184 Merge branch 'size-t/blame' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
6edb5e6a3a Merge branch 'size-t/commit' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
c536505dad Merge branch 'size-t/tree' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
c097e7b10a Merge branch 'size-t/diff-delta-sizeof' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
585eb5c9b7 Merge branch 'size-t/diff' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
4d0e268a5f Merge branch 'size-t/pack-bitmap' 2026-06-22 17:42:27 +02:00
Johannes Schindelin
0815513a67 diffcore: widen struct diff_filespec.size to size_t
Continue the size_t evacuation. The struct field already receives
its writes from a size_t-shaped source (xsize_t(st.st_size),
strbuf.len, fill_textconv()'s return, odb_read_object_info_extended()
via oi.sizep), so on Windows it was already truncating anything
past 4 GiB silently on the strbuf and textconv paths and loudly
through cast_size_t_to_ulong() on the odb path. Switch the field
to size_t.

In diff_populate_filespec(), point oi.sizep at the field directly
and drop both cast_size_t_to_ulong() shims and the size_st bridge
they fed.

Downstream consumers that still read .size into unsigned long
locals will now silently narrow on Windows where the field exceeds
4 GiB. Each of those is its own follow-up; the writer side is the
prerequisite for ever putting a >4 GiB value in the field in the
first place.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:26 +02:00
Johannes Schindelin
5b7c8a82db Merge branch 'size-t/pack-objects-delta' 2026-06-22 17:42:26 +02:00
Johannes Schindelin
4bdd674e3b diff: widen textconv_object() size out-param to size_t
Continue the size_t evacuation. textconv_object() fills its
out-parameter from fill_textconv()'s size_t return through an
unsigned long*; widen the API to match, then take advantage of the
new shape where callers can.

cat-file's 'c' and batch-mode 'c' branches lose their size_ul
bridge variables (one site becomes a direct call, the other
collapses an if/else into a single negated condition that reads as
"try textconv, fall back to a raw read").

blame.c likewise drops the file_size_st bridge in fill_origin_blob()
and hoists final_buf_size_st to bracket both branches in
setup_scoreboard(). The latter keeps a cast_size_t_to_ulong() shim
because struct blame_scoreboard.final_buf_size is still unsigned
long; that field is its own topic.

log.c just widens its local from unsigned long to size_t.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:26 +02:00
Johannes Schindelin
31c379aeb3 combine-diff: stop truncating combined-diff blob sizes on Windows
Continue the size_t evacuation. With buffer_is_binary() widened
in the prior commit, every consumer that the size flows into in
combine-diff.c is size_t-ready, so widen grab_blob()'s out-param
outright and move the matching locals at its three call sites
together. grab_blob()'s body collapses to a direct
odb_read_object(&size) since the bridge variable is no longer
needed.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:26 +02:00
Johannes Schindelin
eb1c32d393 xdiff-interface: widen buffer_is_binary() size parameter to size_t
Prep for the widenings of its callers, where size-receiving locals
will become size_t (combine-diff's result_size in the immediately
following commit, struct diff_filespec.size in a later topic). Body
caps the parameter at 8000 anyway, so the type change is mechanical.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:26 +02:00
Johannes Schindelin
c185a83de7 git-zlib: widen git_deflate_bound() to size_t
All four `unsigned long` / `int` / `ssize_t` receivers across
archive-zip, diff, http-push and t/helper/test-pack-deltas were
widened to size_t in the prior commits, and remote-curl and
fast-import were already there. With every caller prepared, both the
parameter and the return type can now move without introducing any
silent narrowing.

For inputs above zlib's uLong range (i.e. >4 GiB on platforms where
uLong is 32-bit, notably 64-bit Windows), defer to zlib's
stored-block formula (the same fallback it would itself use for an
unknown stream state) plus the worst-case wrapper overhead. The
existing path through deflateBound() is unchanged for inputs that
fit.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:25 +02:00
Johannes Schindelin
c03880cd27 read-cache: stop truncating index blob sizes on Windows
Continue the size_t evacuation. read_blob_data_from_index() reads
the blob through the size_t odb_read_object() API but writes the
size back through an unsigned long out-parameter, silently
truncating anything past 4 GiB on Windows. Widen the out-parameter,
drop the cast_size_t_to_ulong() shim, and move the matching locals
in the two convert.c callers and the one in attr.c. Their
downstream consumers (gather_convert_stats() widened in the prior
commit and read_attr_from_buf() already size_t) take the new type
directly.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:25 +02:00
Johannes Schindelin
9f5f5f76b3 t/helper/test-pack-deltas: widen do_compress()'s maxsize local to size_t
Prep for the upcoming git_deflate_bound() widening to size_t. The
local is only ever the return value of git_deflate_bound() and the
xmalloc() / stream.avail_out sizes derived from it; widening it has
no semantic effect today.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:25 +02:00
Johannes Schindelin
01deab1021 convert: widen gather_convert_stats() helpers to size_t
Prep for the upcoming read_blob_data_from_index() widening, whose
callers in convert.c feed the size they receive straight into these
two helpers. Both are file-static, so the change is contained.

Also fixes a small pre-existing narrowing on the get_wt_convert_stats_ascii()
path, where strbuf.len (size_t) was passed to a unsigned long
parameter.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-06-22 17:42:25 +02:00