Commit Graph

16230 Commits

Author SHA1 Message Date
Edward Thomson
e279d645f1 oid: sha1s must now be zero-padded
Now that we have two types of object IDs, with different sizes, we
expect shorter object ID types (in other words, SHA1 object ids) to be
zero-padded at their suffix. This allows us to use faster comparison and
copy routines over the entirety of the structure, instead of trying to
examine the type and then do a comparison of the appropriately sized
structure.

For pure manipulation of object IDs, this produces parity with the
SHA1-only object ID code.

SHA1:
oid::cmp_sha1:  8.065 ms ± 703.9 μs / range: 7.875 ms … 14.88 ms  (201 runs)
oid::cmp_sha256:  skipped
oid::cpy_sha1:  5.340 ms ± 47.26 μs / range: 5.272 ms … 5.617 ms  (548 runs)
oid::cpy_sha256:  skipped
oid::zero_sha1:  5.327 ms ± 49.27 μs / range: 5.271 ms … 5.612 ms  (553 runs)
oid::zero_sha256:  skipped

SHA256 (before this change; testing the `type`):
oid::cmp_sha1:  10.82 ms ± 1.029 ms / range: 10.57 ms … 20.63 ms  (145 runs)
oid::cmp_sha256:  10.63 ms ± 103.9 μs / range: 10.50 ms … 11.48 ms  (279 runs)
oid::cpy_sha1:  26.13 ms ± 63.91 μs / range: 26.07 ms … 26.45 ms  (113 runs)
oid::cpy_sha256:  20.92 ms ± 58.32 μs / range: 20.86 ms … 21.25 ms  (141 runs)
oid::zero_sha1:  13.19 ms ± 129.1 μs / range: 13.11 ms … 13.72 ms  (224 runs)
oid::zero_sha256:  13.12 ms ± 30.06 μs / range: 13.10 ms … 13.30 ms  (225 runs)

SHA256 (with this change):
oid::cmp_sha1:  7.985 ms ± 562.3 μs / range: 7.874 ms … 14.32 ms  (209 runs)
oid::cmp_sha256:  6.609 ms ± 30.77 μs / range: 6.584 ms … 6.870 ms  (443 runs)
oid::cpy_sha1:  5.282 ms ± 21.90 μs / range: 5.266 ms … 5.524 ms  (543 runs)
oid::cpy_sha256:  5.279 ms ± 17.57 μs / range: 5.263 ms … 5.415 ms  (554 runs)
oid::zero_sha1:  5.288 ms ± 22.92 μs / range: 5.268 ms … 5.508 ms  (544 runs)
oid::zero_sha256:  5.286 ms ± 21.29 μs / range: 5.271 ms … 5.527 ms  (542 runs)
2026-05-06 23:03:46 +01:00
Edward Thomson
4e7a7e090c Merge pull request #7139 from dyfer/fix-xcode-static-lib
cmake: fix creation of static lib in xcode
2026-05-06 22:05:49 +01:00
Edward Thomson
af1e2fa3d0 Merge pull request #7117 from pks-gitlab/pks/reftables-support
Reftables support
2026-05-06 22:02:32 +01:00
Edward Thomson
7a12070f5a Merge pull request #7121 from yonathan-ashebir/main
Adding missing includes in public header files
2026-05-06 22:01:18 +01:00
Edward Thomson
b6a9e9a994 Merge pull request #7051 from timonvo/diff-from-buffer-binary-roundtrip
diff: make `git_diff_from_buffer` diffs show binary data when printed.
2026-05-06 21:48:25 +01:00
Kevin Saul
3e5b7ed79b remote: don't create empty FETCH_HEAD file when update suppressed (#7244) 2026-05-06 17:37:41 +01:00
Edward Thomson
f687244dc2 Merge pull request #7252 from libgit2/ethomson/docs-update 2026-05-05 07:05:24 +01:00
Edward Thomson
95bacb75a1 docs: update README to remove Coverity Scan badge (#7251)
Removed Coverity Scan Status badge from Nightly builds section. Coverity apparently has ceased to be.
2026-05-04 23:26:22 +01:00
Edward Thomson
eb0f7a734e docs: proceed when version folder doesn't exist
A version folder may not exists (for example, when adding a new
version). Proceed!
2026-05-04 23:25:08 +01:00
Edward Thomson
cf028e7e9a Merge pull request #7246 from libgit2/ethomson/redirect
Handle redirects with `Content-Length: 0` correctly
2026-05-04 21:39:51 +01:00
Edward Thomson
07c737f235 Merge pull request #7249 from kcsaul/fix/missing-library-error
cmake: fix linker error when using ninja build generator
2026-05-04 21:29:15 +01:00
Kevin Saul
50fa757381 cmake: fix linker error when using ninja build generator 2026-05-05 07:40:20 +12:00
Edward Thomson
242d66e931 httpclient: stop if there's no content length
When we were done reading headers, we checked if we needed to read a
body, or if we were done. The body check was done by looking at the
transfer encoding type and the content type. If we were chunked, then we
know we have a body (it may be a zero byte body, but we would need to
read the chunk length to know this). But looking at the content _type_
was erroneous; we should have been looking at the content _length_.

The effect of this is that when a server sends a zero byte response
with a content _type_, we try to go read the body, which does not exist.
We will hang waiting for the body that the server will never send.

Correct this typo. Now we will try to read the body if there was a
content _length_ specified, or if the transfer encoding is chunked.
2026-05-04 19:52:45 +01:00
Edward Thomson
293aa39785 httpclient: update complete_response_body explanation 2026-05-04 19:52:45 +01:00
Edward Thomson
c6de625624 ci: use the new initial-redirect:none repo
poxygit now supports a "specification" within the URI that can provide
additional details about the mock/debugging connection. The `:none`
suffix on the redirect request indicates that the proxy should send a 0
byte response body.
2026-05-04 19:52:45 +01:00
Edward Thomson
4dc25c267b Merge pull request #7248 from libgit2/ethomson/poxygit
ci: use poxygit v0.8.1 in the tests
2026-05-04 19:48:40 +01:00
Edward Thomson
c9dd053d71 ci: use poxygit v0.8.1 in the tests
Update our CI to use poxygit v0.8.1, which has additional mocking and
debugging capabilities.

As part of this, the paths to the `speed` test routes changed - now they
are `speed:<n>` where `<n>` is the speed to emulate in bps.
2026-05-04 17:47:50 +01:00
Edward Thomson
4cc873458e Merge pull request #7003 from mathworks/lrm29/issue6963
submodule: git_index_add_bypath does not move conflict entries to REU…
2026-05-03 12:48:11 +01:00
Edward Thomson
5332759cff Merge pull request #7243 from libgit2/ethomson/index-stats 2026-05-02 19:05:04 +01:00
Edward Thomson
509ac11975 Zero indexer stats in pack objects 2026-05-02 18:08:42 +01:00
Edward Thomson
38a5767ec5 Merge pull request #7001 from libgit2/ethomson/object_id
Introduce `git_object_id_from...` APIs
2026-05-02 17:36:17 +01:00
Edward Thomson
af304578e1 Merge pull request #7049 from mathworks/git_indexer_stats_init
indexer: Initialise all members of git_indexer_progress
2026-05-02 17:34:44 +01:00
Edward Thomson
63c0757b4f odb: deprecate git_odb_hash
Hash generation is not a concern of the object database; deprecate
`git_odb_hash`.
2026-05-02 14:17:21 +01:00
Edward Thomson
8bb32e5780 object: move internal use to git_object_id_from...
Using the `git_object_id_from` is an overall code simplification; switch
to it.
2026-05-02 14:17:21 +01:00
Edward Thomson
2dd70bc196 object: introduce git_object_id_from... APIs
Introduce APIs within the `git_object` namespace to calculate the IDs
of objects based on their raw content.
2026-05-02 14:17:21 +01:00
Edward Thomson
200aace53d Merge pull request #7165 from ambv/tcp-keepalive
fix: prevent SSH timeout infinite loop and enable TCP keepalive
2026-05-02 14:12:25 +01:00
Edward Thomson
16cb9c5ed8 Merge pull request #7239 from libgit2/ethomson/mergefix
merge_files: avoid UB in xdiff
2026-05-02 08:44:05 +01:00
Edward Thomson
a7b267c7a6 Merge pull request #7238 from kanru-contrib/null-terminate-pack-buffer
fix(pack): ensure pack_backend__read returns null terminated buffer
2026-05-02 08:33:47 +01:00
Edward Thomson
43b5707765 Merge pull request #7241 from kcsaul/fix/cmake-temp-header
cmake: write git.h.tmp to current binary directory
2026-05-02 08:27:13 +01:00
Edward Thomson
a25d9a18fa xdiff: don't try to malloc 0 bytes
For zero byte files, avoid allocation - this avoids undefined behavior
around malloc(0) and potentially memcpy(..., NULL, 0).
2026-05-02 08:24:18 +01:00
Edward Thomson
643b7e1038 merge_files: some simplification 2026-05-02 08:24:18 +01:00
Edward Thomson
8d4d980b10 merge_files: test with zero-byte file
Test handing a zero byte but extant file to merge_files.
2026-05-02 08:24:18 +01:00
Kevin Saul
5b59e4a180 cmake: write git.h.tmp to current binary directory 2026-05-02 13:56:47 +12:00
Kan-Ru Chen
22e80c6065 fix(pack): ensure pack_backend__read returns null terminated buffer
Depending on the zlib library used, the inflate() function may write
beyond the object size into the additional trailing buffer for aligned
memory copies. This may cause out-of-bounds memory read if the object
buffer is later used without checking the object size, as in
git_commit__extract_signature.

Link: https://github.com/zlib-ng/zlib-ng/issues/1767
Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
2026-05-01 07:47:54 +09:00
Edward Thomson
cefc409a97 Merge pull request #7092 from eantoranz/git_merge_file_from_index-null_child
git_merge_file_from_index: handle cases when a child (ours or theirs) is null
2026-04-30 23:39:06 +01:00
Edward Thomson
70ff46d7fe Merge pull request #7236 from libgit2/ethomson/lengths
Check object lengths against headers in `read_loose`
2026-04-30 23:19:07 +01:00
Edward Thomson
a1c807c79e object: test looking up truncated objects
Add a test that looks up an invalid, truncated object, that is shorter
than the advertised length.
2026-04-30 22:59:20 +01:00
Edward Thomson
249b9d6aad Merge pull request #7234 from libgit2/ethomson/cmake
cmake: don't recreate git2.h unnecessarily
2026-04-29 21:33:08 +01:00
Edward Thomson
d5241a2c04 cmake: don't recreate git2.h unnecessarily
Instead of regenerating `git2.h` on every cmake invocation, use
`configure_file` to avoid rewriting it. This keeps timestamps inline and
avoids unnecessarily rebuilding the library.
2026-04-29 20:56:29 +01:00
Edward Thomson
56883f9e9d Merge pull request #7232 from kcsaul/fix/config-memory-backend
Config Memory Backend Corruption Fix
2026-04-29 20:34:40 +01:00
Edward Thomson
445193c4f8 Merge pull request #7118 from oliverchang/fix
Fixed a heap-buffer-overflow in the smart_pkt.c:set_data function.
2026-04-29 20:15:04 +01:00
Edward Thomson
81706d1b35 Merge pull request #7231 from libgit2/ethomson/worktree_fi
repository: fix operators in `foreach_worktree`
2026-04-29 15:25:34 +01:00
Kevin Saul
d30a69c63d config: fix crash after memory backend entry freed 2026-04-29 22:24:33 +12:00
Kevin Saul
3b5ecb0d42 config: update memory backend test to reproduce crash 2026-04-29 22:11:28 +12:00
Edward Thomson
c0a4ef05f4 repository: fix operators in foreach_worktree
Fix a simple operator precedence bug in
`git_repository_foreach_worktree`.
2026-04-29 09:44:05 +01:00
Edward Thomson
c16683f5fb Merge pull request #7230 from libgit2/ethomson/clar-2
clar: update with const correct iterator
2026-04-28 21:14:38 +01:00
Edward Thomson
124a1a801b clar: update with const correct iterator 2026-04-28 15:25:58 +01:00
Edward Thomson
1e7d7c07d0 Merge pull request #7195 from weihanglo/insteadof
fix: apply insteadOf from global config for detached remotes
2026-04-24 11:19:47 +01:00
Edward Thomson
8a1f012861 Merge pull request #7229 from weihanglo/fix
fix(transport): get oid_type on local transport
2026-04-24 11:14:02 +01:00
Weihang Lo
e047e80074 fix(transport): get oid_type on local transport
Cache `oid_type` in `transport_local` struct during `connect()`
so `git_remote_oid_type()` keeps working after disconnect.

This matches the smart transport behavior.
2026-04-23 23:17:57 -04:00