140 Commits

Author SHA1 Message Date
Edward Thomson
b3e04a0def fix 2026-06-01 10:07:48 +01:00
Edward Thomson
5022cb5f80 deps: remove old pcre dependency 2026-06-01 09:55:06 +01:00
Edward Thomson
64469259a5 deps: pcre2 updates with c90 compatible syntax
Yes, the world has moved on from us.
2026-06-01 09:55:06 +01:00
Edward Thomson
993397a603 deps: pcre2 needs explicit static options 2026-06-01 09:54:57 +01:00
Edward Thomson
7842631242 deps: include pcre2
Ye olde PCRE (8.45) was end-of-lifed several years ago. For our bundled
regular expression implementation, we want to include the new,
still-maintained PCRE2 framework. Include PCRE2 v10.47.
2026-06-01 09:53:58 +01:00
Edward Thomson
b1b421fe4b cmake: separate generated headers from translated headers
Make a distinction between generated headers and "translated" headers.
This is important to support build-time dependencies when headers are
updated.

Generated headers are those which contain build-time feature
specifications, like `git2_features.h` that are internal to the build
and `experimental.h` that contain API information.

Translated headers are the headers that are in `include/git2`, but may
be translated to have a unique prefix like `incklude/git2-experimental`.

This distinction is important so that the CMakeFiles.txt depend on the
in-tree include files (`src/include`) and the generated header files
_but not_ the translated header files. Otherwise there are two `pack.h`
and it's unclear whether the in-tree build is targeting the one in
`src/include` or the one in the build tree.

Without this, updating an in-tree header file like `pack.h` would not
cause a rebuild of its dependencies.
2026-05-16 13:01:55 +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
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
124a1a801b clar: update with const correct iterator 2026-04-28 15:25:58 +01:00
Patrick Steinhardt
5c6cba5142 tests: wire up reftable tests
Wire up reftable tests so that they can be executed by setting the
`CLAR_REF_FORMAT` environment variable. This only catches tests that use
`cl_git_sandbox_init()`, but that should cover most of our tests. So
this infrastructure isn't perfect, but for now it's good enough. We may
want to iterate on it in the future.
2026-04-16 14:56:46 +02:00
Patrick Steinhardt
6701e02f1c refdb: implement reftable backend
Implement the reftable backend that is used to read and write reftables.
The backend is not yet used anywhere after this commit.
2026-04-16 14:56:46 +02:00
Patrick Steinhardt
641a43c90d deps/reftable: wire up library with CMake
Wire up the reftable library with CMake. At the current point in time
the library is not yet plugged into libgit2 itself.
2026-04-16 14:56:46 +02:00
Patrick Steinhardt
9e3b00acfb deps/reftable: implement system compatibility code
While the reftable library is mostly decoupled from the Git codebase,
some specific functionality intentionally taps into Git subsystems. To
make porting of the reftable library easier all of these are contained
in "system.h" and "system.c".

Reimplement those compatibility shims so that they work for libgit2.
2026-04-16 14:56:46 +02:00
Patrick Steinhardt
623a3783bb deps: import reftable library
Import the reftable library from commit 4fee6ff3b2 (Merge branch
'ps/reftable-portability', 2026-04-08). This is an exact copy of the
reftable library.

The library will be wired into libgit2 over the next couple of commits.
2026-04-09 06:48:35 +02:00
Patrick Steinhardt
5e058b54ee tests/clar: introduce cl_repo_has_ref_format()
Introduce a function that reads the "refStorage" extension so that we
can easily figure out whether a specific repository uses the "files" or
any other reference format. While we don't support other formats yet, we
are about to add support for the "reftable" format.
2026-03-30 07:50:44 +02:00
Edward Thomson
d55ff3cd70 clar: fix remove unused 2026-01-26 21:43:06 +00:00
Edward Thomson
3ac6bf801c clar: avoid iterator clobbered by longjmp
If the iterator is moved to a register, it may be clobbered by the
longjmp. Avoid this by treating it as volatile.
2026-01-26 21:43:06 +00:00
Edward Thomson
1a0bbabe30 clar update for benchmarks 2026-01-26 21:43:06 +00:00
Edward Thomson
1424585fb6 tests: move clar to deps
Clean up the `tests` folder to only contain _actual tests_. Since clar
is now a reasonably external project, move it to `deps`.
2026-01-26 21:43:06 +00:00
Edward Thomson
b8f6ff30ee pcre: actually fix dangling-pointer warning 2026-01-26 11:00:08 +00:00
Edward Thomson
1114364b87 pcre: update cmake warnings for non-gcc 2026-01-26 09:57:40 +00:00
Edward Thomson
ba39ae2c59 pcre: avoid false positive dangling pointer warning
PCRE sets the contents of an external structure to a local pointer
temporarily. gcc warns about this. Silence that dangling pointer
warning.
2026-01-25 16:48:56 +00:00
Edward Thomson
a7c4c7d8c8 deps: remove chromium-zlib
Remove the ability to compile-in chromium zlib. If users want to supply
their own zlib implementation, it should be external to our build
environment.
2025-01-02 21:13:11 +00:00
Edward Thomson
4546929e00 cmake: case insensitive options
It's hard to remember whether it's `-DUSE_HTTPS=mbedTLS` or
`-DUSE_HTTPS=mbedtls`. Even worse for things like `builtin` which we may
have been inconsistent about. Allow for case insensitive options.
2025-01-02 12:36:46 +00:00
Edward Thomson
7db332022b llhttp: use c-style comments 2024-10-19 14:29:57 +01:00
Edward Thomson
d090433ef1 cmake: use CMAKE_C_STANDARD and CMAKE_C_EXTENSIONS
cmake already provides a standard way for callers to override the
C_STANDARD and C_EXTENSIONS properties. Support and document those.
2024-10-19 13:18:53 +01:00
Edward Thomson
6c70f24d89 Update ntlmclient dependency 2024-10-18 23:24:10 +01:00
GravisZro
f1cac063ba Mandate C90 conformance
This PR ensures and enforces C90 conformance for all files C, including tests.

* Modify CMakeLists.txt to mandate C90 conformance (for better compiler compatibility)
* Update deps/ntlmclient/utf8.h to latest version
* Modify two tests and one header to use C comments instead of C++ comments
2024-10-18 22:26:57 +01:00
Edward Thomson
b72dfb0e73 zlib: update bundled zlib to v1.3.1 2024-10-07 21:38:30 +01:00
Edward Thomson
60f6ff57ba ci: avoid compiler warnings for unused in pcre 2024-09-27 12:24:09 +02:00
Edward Thomson
bb3c31f327 xdiff: use proper free function 2024-05-13 10:44:06 +01:00
Edward Thomson
fb1797de63 Merge remote-tracking branch 'origin/main' into libgit2-httpparser 2024-04-23 00:09:50 +01:00
Edward Thomson
98c4955390 http: remove legacy bundled http-parser
Users can still use the legacy Node.js http-parser library, but now we
bundle llhttp and prefer it.
2024-04-22 22:21:23 +01:00
Edward Thomson
d02b549dab http: make llhttp the default 2024-04-22 22:21:23 +01:00
Edward Thomson
3599de9073 http: add llhttp as a bundled dependency
Include llhttp as a bundled dependency with the aim to use it as our
default http parser, removing the now-unmaintained Node.js http-parser.
2024-04-22 22:21:23 +01:00
Edward Thomson
0f12a011ab Merge pull request #6770 from libgit2/ethomson/ctype
cast characters to unsigned when classifying characters
2024-03-18 11:31:39 +00:00
Edward Thomson
467556993f ntlmclient: use unsigned char for ctype functions 2024-03-18 11:07:47 +00:00
Edward Thomson
079861729b build: update ntlmclient dependency
The ntlmclient dependency now bundles an MD4 implementation for
compatibility with newer mbedTLS. Include that so that we can support
mbedTLS 3.
2024-03-16 14:32:54 +00:00
Edward Thomson
66f587b526 ntlmclient: update to latest upstream ntlmclient 2023-12-21 20:25:55 +00:00
Edward Thomson
d83fccc97a zlib: upgrade bundled zlib to v1.3 2023-12-20 12:05:48 +00:00
Edward Thomson
4681b3aee4 ntlmclient: update to latest version
Ensure that we declare variables at the top of the block for broad
compatibility with old compilers.
2023-12-14 13:42:12 +00:00
Edward Thomson
c02fe8d279 deps: update pcre to 8.45 2023-07-15 16:16:48 +01:00
Edward Thomson
027630ddd4 xdiff: update to xdiff from git 2.40.1 2023-05-11 21:44:17 +01:00
Edward Thomson
462dbe21d0 xdiff: move xdiff to 'deps'
xdiff is a dependency (from git core) and more properly belongs in the
'deps' directory. Move it there, and add a stub for cmake to resolve
xdiff from the system location in the future. (At present, bundled xdiff
remains hardcoded.)
2023-03-03 09:45:12 +00:00
Edward Thomson
655158fa7a Add OpenSSL deprection warning
Add `OPENSSL_API_COMPAT=0x10100000L` since we use the now-deprecated
low-level hash functions.
2023-02-02 07:54:16 -05:00
Mark Adler
af76267ad7 zlib: Silence some warnings from Visual Studio C. 2022-07-12 14:27:46 -04:00
Andrzej Hunt
39ba0ee604 zlib: slide_hash: add MSAN annotation to suppress known read from uninitialised memory
slide_hash knowingly reads (possibly) uninitialised memory, see comment
lower down about prev[n] potentially being garbage. In this case, the
result is never used - so we don't care about MSAN complaining about
this read.

By adding the no_sanitize("memory") attribute, clients of zlib won't
see this (unnecessary) error when building and running with
MemorySanitizer. An alternative approach is for clients to build zlib
with -fsanitize-ignorelist=... where the ignorelist contains something
like 'fun:slide_hash'. But that's more work and needs to be redone
for any and all CI systems running a given project with MSAN. Adding
this annotation to zlib's sources is overall more convenient - but
also won't affect non-MSAN builds.

This specific issue was found while running git's test suite, but has
also been reported by other clients, see e.g. #518.
2022-07-12 14:27:46 -04:00
Edward Thomson
6febb7d767 zlib: declare prototypes for new functions
The `crc32_combine_gen64` missed a prototype in our define path.
Add one.
2022-07-12 14:27:46 -04:00
Edward Thomson
2db6cdcd66 zlib: updated bundled zlib to v1.2.12 2022-07-12 14:27:46 -04:00
Charlie Li
628ebbde6e ntlmclient: LibreSSL 3.5 removed HMAC_CTX_cleanup
https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.5.0-relnotes.txt

Modify guard to declare dummy function.
2022-07-03 20:44:41 -04:00