491 Commits

Author SHA1 Message Date
Edward Thomson
4802272f68 cmake: remove "embedded libssh2"
Compiling libssh2 into libgit2 directly is madness. If users want to
create a single library that contains libssh2, then they should link a
static library.
2025-01-02 21:13:50 +00:00
Edward Thomson
9efdbe3834 cmake: standardize leak check option
The `GIT_WIN32_LEAKCHECK` option is a debugging option, so it should be
`GIT_DEBUG_LEAKCHECK_WIN32`
2025-01-02 12:36:11 +00:00
Edward Thomson
2b581ef517 cmake: update threads
For consistency with other backend/provider selection, allow
`USE_THREADS` to select the threads provider.
2025-01-02 12:36:11 +00:00
Edward Thomson
890d70856c cmake: update nanosecond selection
For consistency, specify the nanosecond option in the same way as other
options, and identify it as such. Split the detection of platform
support (`FindStatNsec`) and its selection (`SelectNsec`).
2025-01-02 12:36:11 +00:00
Edward Thomson
8bbd2f406e cmake: use DEBUG_LEAK_CHECKER as option
The `USE_` prefix for inputs denotes a backend; the `DEBUG_` prefix
denotes a debugging option. Make `DEBUG_LEAK_CHECKER` the name of the
leak checking option.
2025-01-02 12:36:11 +00:00
Edward Thomson
c9974d28b2 cmake: update Negotiate backend selection 2025-01-02 12:36:11 +00:00
Edward Thomson
fb59acb246 cmake: update NTLM feature enablement 2025-01-02 12:36:09 +00:00
Edward Thomson
9ea1f6d4ed cmake: standardize iconv options 2025-01-02 11:45:47 +00:00
Edward Thomson
78a8c44cc1 cmake: standardize regex options
Selecting regular expression backend should be specified in the same way
as everything else; `USE_REGEX`. Keep `REGEX_BACKEND` as an optional
fallback.
2025-01-02 11:45:47 +00:00
Edward Thomson
fdb73f5d1d cmake: simplify compression selection 2025-01-02 11:45:47 +00:00
Edward Thomson
c4a65c34c2 cmake: standardize builtin sha1dc selection
All `USE_*` options are now `builtin`. Use that for the builtin sha1dc
implementation, keeping `CollisionDetection` for backward compatibility.
2025-01-02 11:45:47 +00:00
Edward Thomson
550cf62021 cmake: warn for not using sha1dc
git's hash algorithm is sha1dc, it is not sha1. Per Linus:

> Honestly, git has effectively already moved from SHA1 to SHA1DC.
>
> So the actual known attack and weakness of SHA1 should simply not be
> part of the discussion for the next hash. You can basically say "we're
> _already_ on the second hash, we just picked one that was so
> compatible with SHA1 that nobody even really noticed.

Warn users who try to compile with SHA1 instead of SHA1DC.
2024-12-28 09:52:42 +00:00
Edward Thomson
c536fcbb85 v1.9: update version numbers
Update the library's (API) version number to v1.9.0. Also update the
soname version number to 2.0, since we've had breaking ABI changes
to the library.
2024-12-28 01:00:19 +00:00
Edward Thomson
d37d6a9f03 cmake: better document dependency options 2024-10-22 11:45:58 +01:00
Edward Thomson
d1d65787b4 cmake: enforce USE_HTTPS validity 2024-10-22 11:45:58 +01:00
Edward Thomson
2125e3c64d cmake: enforce USE_SSH validity
Validate the USE_SSH option fits into our valid options; don't
assume a default.
2024-10-22 11:13:43 +01:00
Edward Thomson
0c675b8c84 cmake: enforce USE_HTTP_PARSER validity
When `-DUSE_HTTP_PARSER=...` is specified, ensure that the specified
HTTP Parser is valid, do not fallback to builtin.

Restore `-DUSE_HTTP_PARSER=system` for backcompatibility.
2024-10-22 10:07:12 +01:00
Edward Thomson
0013a6f9b2 cmake: default to c99 on android 2024-10-19 18:19:38 +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
41a41b4f4a cmake: make C_STANDARD and C_EXTENSIONS configurable
Users can now set up cmake with -DC_STANDARD=... or -DC_EXTENSIONS=...
We default to C90 with C_EXTENSIONS=OFF, but callers can override if
they desire.
2024-10-18 22:26:57 +01:00
Edward Thomson
e9d56b0b14 v1.8.2: update version numbers 2024-06-13 19:43:46 +02:00
Edward Thomson
834ec0f52f v1.8.1: update version numbers 2024-05-16 00:49:40 +01:00
Edward Thomson
3fccf7468b ssh: GIT_SSH_LIBSSH2 is now distinct from GIT_SSH
We may want to support SSH but with a different provider that is not
libssh2. Add GIT_SSH to indicate that we have some inbuilt SSH support
and GIT_SSH_LIBSSH2 to indicate that support is via libssh2. This is
similar to how we support GIT_HTTPS and GIT_OPENSSL, for example.
2023-08-30 20:46:21 +01:00
Edward Thomson
62498558ff meta: update version numbers to v1.8 2023-07-17 11:07:50 +01:00
Edward Thomson
3335738579 cmake: refactor check_prototype_definition
Introduce `check_prototype_definition_safe` that is safe for `Werror`
usage.
2023-05-12 21:49:29 +01:00
Edward Thomson
abb0b31317 Merge pull request #6482 from libgit2/ethomson/xdiff
xdiff: move xdiff to 'deps'
2023-04-13 23:08:15 +01:00
Edward Thomson
3630883094 meta: the main branch is now v1.7.0 2023-04-12 12:06:22 +01:00
Edward Thomson
9bfad74dc0 Merge pull request #6533 from libgit2/ethomson/schannel-2
Introduce Schannel and SSPI for Windows
2023-03-27 11:58:14 +01:00
Edward Thomson
2173ca8a41 v1.6.3: update version numbers 2023-03-21 10:13:23 +00:00
Edward Thomson
f68f542eb6 http: introduce schannel streams for windows
Provide a stream interface for Schannel - the native crypto APIs - on
Windows. This allows Windows to use the same HTTP transport that all the
other platforms use, with its own native crypto.

Ultimately this allows us to deprecate WinHTTP and we need not add
support for our socket changes in two places (our HTTP stack and the
WinHTTP stack).
2023-03-21 09:09:48 +00: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
9d1a3ef7c7 v1.6.2: update version numbers 2023-02-28 10:18:00 +00:00
Edward Thomson
8a871d13b7 v1.6.1: correct missing version number updates 2023-02-25 13:53:43 +00:00
Edward Thomson
ef235a1662 v1.6: update version numbers 2023-02-24 22:21:41 +00:00
Edward Thomson
6c57bac6b1 sha256: make sha256 an experimental optional feature
libgit2 can be built with optional, experimental sha256 support. This
allows consumers to begin testing and providing feedback for our sha256
support while we continue to develop it, and allows us to make API
breaking changes while we iterate on a final sha256 implementation.

The results will be `git2-experimental.dll` and installed as
`git2-experimental.h` to avoid confusion with a production libgit2.
2022-06-20 17:12:49 -04:00
Edward Thomson
83c2778611 sha: support CommonCrypto for SHA256 2022-03-23 08:39:19 -04:00
Edward Thomson
b900981cf7 sha: add sha256 algorithm
Add support for a SHA256 hash algorithm, and add the "builtin" SHA256
hash engine (from RFC 6234).
2022-03-23 08:39:19 -04:00
Edward Thomson
8bc998f481 sha1: remove generic implementation
Remove the "generic" implementation; it should never be used; it only
existed for a no-dependencies configuration, and our bundled sha1dc
satisfies that requirement _and_ is correct.
2022-03-23 08:39:19 -04:00
Edward Thomson
b08fe71d3b cmake: export libraries needed to compile against libgit2
If users are using us as a direct dependency (via `add_subdirectory`)
then they may want to know the libraries to link to; tell them.
2022-02-27 23:16:05 -05:00
Edward Thomson
3a3ab065f0 cli: infrastructure for a cli project
Introduce a command-line interface for libgit2.  The goal is for it to
be git-compatible.

1. The libgit2 developers can more easily dogfood libgit2 to find bugs,
   and performance issues.

2. There is growing usage of libgit2's examples as a client; libgit2's
   examples should be exactly that - simple code samples that illustrate
   libgit2's usage.  This satisfies that need directly.

3. By producing a client ourselves, we can better understand the needs
   of client creators, possibly producing a shared "middleware" for
   commonly-used pieces of client functionality like interacting with
   external tools.

4. Since git is the reference implementation, we may be able to benefit
   from git's unit tests, running their test suite against our CLI to
   ensure correct behavior.

This commit introduces a simple infrastructure for the CLI.

The CLI is currently links libgit2 statically; this is because the
utility layer is required for libgit2 _but_ shares the error state
handling with libgit2 itself.  There's no obviously good solution
here without introducing annoying indirection or more complexity.
Until we can untangle that dependency, this is a good step forward.

In the meantime, we link the libgit2 object files, but we do not include
the (private) libgit2 headers.  This constrains the CLI to the public
libgit2 interfaces.
2022-02-26 14:43:48 -05:00
Edward Thomson
5fcfada500 cmake: document CMakeLists.txt hierarchy 2022-02-22 22:07:44 -05:00
Edward Thomson
ae74d5ac41 meta: update version number to v1.5.0-alpha
Update the version number in main to v1.5.0-alpha.  This helps people
understand that the main builds are not part of the v1.4.0 release
train.

We use "alpha" to indicate builds out of main (or nightlies) as semver
v2 requires the prerelease component is compared lexicographically.
Thus, our "beta" and "rc" releases should follow.
2022-02-14 07:01:43 -05:00
Edward Thomson
5c949d1faf v1.4: update version numbers 2022-02-13 10:06:15 -05:00
Josh Junon
c5cd71b203 cmake: use PROJECT_SOURCE_DIR of CMAKE_SOURCE_DIR
Also applies to *_BINARY_DIR.

This effectively reverts 84083dcc8b,
which broke all users of libgit2 that use it as a CMake subdirectory
(via `add_subdirectory()`). This is because CMAKE_SOURCE_DIR refers
to the root-most CMake directory, which in the case of
`add_subdirectory()` is a parent project to libgit2 and thus the paths
don't make any sense to the configuration files. Corollary,
CMAKE_SOURCE_DIR only makes sense if the CMake project is always the
root project - which can rarely be guaranteed.

In all honesty, CMake should deprecate and eventually remove
CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. It's been the source of headaches
and confusion for years, they're rarely useful over
CMAKE_CURRENT_(SOURCE|BINARY)_DIR or PROJECT_(SOURCE|BINARY)_DIR,
and they cause a lot of confusing configuration and source
code layouts to boot.

Any time they are used, they break `add_subdirectory()` almost 100% of
the time, cause confusing error messages, and hide subtle bugs.
2021-12-23 18:23:34 +01:00
Edward Thomson
84083dcc8b cmake: use CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR
Instead of using the project-specific `libgit2_SOURCE_DIR` and
`libgit2_BINARY_DIR` variables, use `CMAKE_SOURCE_DIR` and
`CMAKE_BINARY_DIR`.
2021-11-22 09:27:59 -05:00
Edward Thomson
4a54d8e39e cmake: enable testing at the top level
Ensure that we `enable_testing()` at the top-level CMakeLists.txt or
else we'll need to navigate within the build directory to the correct
place in the hierarchy to run `ctest`.  Now we can `ctest` at the
top-level again.
2021-11-17 07:27:39 -05:00
Edward Thomson
c7f6ecb391 cmake: use a string not a boolean for LIBGIT2_FILENAME 2021-11-14 07:25:41 -05:00
Edward Thomson
d3a7a352d5 cmake: move test enablement into test cmake 2021-11-11 15:56:10 -05:00
Edward Thomson
207beff541 cmake: reorganize file 2021-11-11 15:56:10 -05:00
Edward Thomson
4d2a6839dc cmake: move fuzzer args to the fuzzer's cmake 2021-11-11 15:56:10 -05:00