Commit Graph

15910 Commits

Author SHA1 Message Date
Edward Thomson
c605f4281b Merge pull request #6995 from libgit2/ethomson/cmd_version
cli: add version command
2025-01-02 13:14:41 +00:00
Edward Thomson
80ce38c9d9 Merge pull request #6996 from libgit2/ethomson/sha256_int
hash: allow `unsigned int` != `size_t` in sha256
2025-01-02 13:14:20 +00:00
Edward Thomson
fb7fef0d72 hash: allow unsigned int != size_t in sha256
Our bundled SHA256 implementation passes a `size_t` as an `unsigned
int`. Stop doing that.
2025-01-02 12:39:54 +00:00
Edward Thomson
24d50ad87b cli: add version command
Move the `--version` information into its own command, so that we can
support `--build-options`.
2025-01-02 12:39:33 +00:00
Edward Thomson
9961198879 Merge pull request #6982 from libgit2/ethomson/no_dotgit_for_separate_workdir
No `.git` for separate workdir
2024-12-30 21:17:43 +00:00
Edward Thomson
ca2a241e4c repo: workdir_path implies no dotgit in init
When specifying a separate working directory path, the given repository
path should never have a `.git` directory created beneath it. That
simply doesn't make sense.

As a result, the `GIT_REPOSITORY_INIT_NO_DOTGIT_DIR` now _also_ no
longer makes sense. It would only ever be a sensible option when one
wanted a separate `.git` directory and working directory, otherwise the
git files and working directory files would be comingled. Remove the
option entirely.
2024-12-30 20:36:13 +00:00
Edward Thomson
e9d97bedc2 Merge pull request #6966 from libgit2/ethomson/tls
ssl: enforce TLS v1.2 (or better)
2024-12-28 23:44:12 +00:00
Edward Thomson
338e6fb681 Merge pull request #6990 from libgit2/ethomson/ci v1.9.0 2024-12-28 12:01:25 +00:00
Edward Thomson
76fe3978ae Merge pull request #6989 from libgit2/ethomson/readme 2024-12-28 11:49:15 +00:00
Edward Thomson
e447de936d ci: only build docs on main branch pushes
Don't build docs on pushes to maint branches; those docs should only be
built _on release_. In addition, be safer about not creating an existing
branch from a tracking branch.
2024-12-28 10:59:12 +00:00
Edward Thomson
d7f3fb568e README: add v1.9 builds 2024-12-28 10:27:39 +00:00
Edward Thomson
25d87c2d89 Merge pull request #6987 from libgit2/ethomson/changelog
v1.9: final changelog updates
2024-12-28 10:24:16 +00:00
Edward Thomson
1329f1a1db v1.9: final changelog updates 2024-12-28 10:02:09 +00:00
Edward Thomson
a8fbbf77b8 Merge pull request #6986 from libgit2/ethomson/warn_sha1
cmake: warn for not using sha1dc
2024-12-28 09:58:25 +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
d85c1a1b79 Merge pull request #6985 from libgit2/ethomson/soname_revert
meta: revert soname version update
2024-12-28 09:52:21 +00:00
Edward Thomson
3aeb5bd0f6 meta: revert soname version update
Changing our SONAME / ABI version update policy without an announcement
is a breaking change. Provide time to announce a policy update.
2024-12-28 08:30:39 +00:00
Edward Thomson
dc816591d5 Merge pull request #6979 from libgit2/ethomson/v19 2024-12-28 01:57:34 +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
e96e250446 v1.9: update changelog 2024-12-28 01:00:19 +00:00
Edward Thomson
800a95371c Merge pull request #6984 from libgit2/ethomson/cli
CLI: introduce `init` command
2024-12-28 00:32:57 +00:00
Edward Thomson
838875eb8f Merge branch 'cmake_target' 2024-12-28 00:30:28 +00:00
Edward Thomson
ded9494954 cmake: only add package target for libgit2 itself 2024-12-28 00:26:11 +00:00
Edward Thomson
9f61001ad5 cli: improve option help 2024-12-28 00:02:25 +00:00
Edward Thomson
5350142b9b Merge pull request #6981 from libgit2/ethomson/gitlink_newline 2024-12-27 17:17:35 +00:00
Edward Thomson
5723964ca2 Merge pull request #6983 from libgit2/ethomson/template_path 2024-12-27 17:05:17 +00:00
Edward Thomson
bf5f0b5600 cli: add an init command 2024-12-27 16:50:26 +00:00
Edward Thomson
a844a6cf23 repo: put a newline on the .git link file
The `.git` file, when containing a `gitdir: ` link, should be suffixed
with a trailing newline.
2024-12-27 16:38:26 +00:00
Edward Thomson
0c27a85b41 repo: don't require option when template_path is specified
When a `template_path` is explicitly specified, don't _also_ require an
option to indicate that we should use templates. We, obviously, should.
2024-12-27 16:20:11 +00:00
Edward Thomson
ccc202802c Merge pull request #6962 from ryan-ph/ryanpham/negative-refspec/remote
remote: Handle fetching negative refspecs
2024-12-24 23:55:06 +00:00
Ryan Pham
099e62ca03 remote: Don't use designated initializer 2024-12-24 10:42:57 +09:00
Ryan Pham
6039d28d43 remote: Return first matching refspec
The previous behavior was to return the first match, so this reverts the
clobbering behavior that was introduced in
f7f30ec136.
2024-12-24 10:42:02 +09:00
Ryan Pham
83994dafec remote: Remove unnecessary call
`git_refspec_is_negative()` is already called by
`git_refspec_src_matches_negative()`, so should not be necessary here.
2024-12-24 10:41:56 +09:00
bmarques1995
5d6e679e21 Rebase 2024-12-23 20:27:40 -03:00
Bruno S Marques
3951f96d1a Merge branch 'libgit2:main' into main 2024-12-23 20:31:13 -03:00
Edward Thomson
536f868be6 Merge pull request #6973 from kempniu/ignore-shallow-packets-during-ack-processing
smart: ignore shallow/unshallow packets during ACK processing
2024-12-23 20:15:50 +00:00
Edward Thomson
416a8d4b46 Merge pull request #6978 from libgit2/ethomson/docs
docs: properly parse enum values
2024-12-23 20:14:24 +00:00
Edward Thomson
53c14952ba docs: properly parse enum values
For enum values that are constructed, not literal integers, we need to
parse the inner / implicit expression. For example:

```
GIT_DIFF_REVERSE = (1u << 0)
```
2024-12-23 17:22:43 +00:00
Edward Thomson
430fe23a8c Merge pull request #6974 from libgit2/ethomson/abi
options: update X509 cert constant
2024-12-23 16:17:34 +00:00
Edward Thomson
67900a0fcb options: update X509 cert constant
By placing the X509 cert constant option in the middle of the existing
options, it renumbers everything unnecessarily. Move it to the end in
to avoid breaking changes.
2024-12-23 09:47:03 +00:00
Edward Thomson
95dfb8398d Merge pull request #6971 from libgit2/ethomson/features
Allow consumers to query the "backends" that libgit2 was built with
2024-12-23 09:14:35 +00:00
Michał Kępień
bed00cd032 smart: ignore shallow/unshallow packets during ACK processing
In RPC mode (https), the client sends its list of shallow commits at the
beginning of each request during packfile negotiation, so that the
remote endpoint keeps context.  This causes the remote to prepend
appropriate shallow/unshallow packets to each response sent back to the
client.

However, the store_common() helper function (used in multi_ack mode)
does not cater for this, returning as soon as it encounters any packet
different than an ACK packet and therefore leaving the rest of the HTTP
buffer unprocessed.  This in turn causes subsequent iterations of the
while loop processing ACK packets to process data returned by older HTTP
requests instead of the current one, messing up the packfile negotiation
process.  Given that the wait_while_ack() helper function (called after
the client signals to the remote that it is ready to receive packfile
data) correctly skips over shallow/unshallow packets, packfile contents
can still be received successfully in some cases (depending on message
framing); in some other ones, though (particularly when
git_smart__download_pack() processes an HTTP buffer starting with
shallow/unshallow packets), the fetching process fails with an
"incomplete pack header" error due to the flush packet terminating a set
of shallow/unshallow packets being incorrectly interpreted as the flush
packet indicating the end of the packfile (making the code behave as if
no packfile data was sent by the remote).

Fix by ignoring shallow/unshallow packets in the store_common() helper
function, therefore making the ACK processing logic work on the correct
HTTP buffers and ensuring that git_smart__download_pack() is not called
until packfile negotiation is actually finished.
2024-12-22 23:32:23 +01:00
Edward Thomson
19a031d075 Introduce git_libgit2_feature_backend API
Provide a mechanism to understand the backend provider for feature
within libgit2. For example, one can query the mechanism that provides
HTTPS by asking for the backend for the `GIT_FEATURE_HTTPS`.

This is particularly useful for features that are not completely
isomorphic; the HTTPS providers may have slightly different
functionality that can be controlled (eg, certificates or cipher
support). And the SSH feature is _very_ different between libssh2 and
OpenSSH.

It may also be useful to understand the support for things like the SHA1
or SHA256 backends to ensure that sha1dc is used, or that FIPS mode is
enabled.
2024-12-22 15:37:56 +00:00
Edward Thomson
e0c255dbd6 zlib: add zlib backend status to git2_features.h
Add the status of the zlib backend (builtin or external) to
`git2_features.h`.
2024-12-22 15:37:56 +00:00
Edward Thomson
f866bb97bf features: move version tests out of features test
Move the test for querying version information out of the
`core::features` test and into the `core::version` test.
2024-12-22 08:44:37 +00:00
Edward Thomson
4dcdb64c68 Merge pull request #6965 from libgit2/ethomson/sha256
SHA256 improvements
2024-12-18 22:46:42 +00:00
Edward Thomson
e0edd7d0ec ssl: enforce TLS v1.2 (or better)
Enforce TLS v1.2 or better, and ensure that we use the recommended
ciphers (intermediate compatibility) from Mozilla.

https://wiki.mozilla.org/Security/Server_Side_TLS
2024-12-18 22:41:12 +00:00
Edward Thomson
12f1706a67 Merge pull request #6964 from libgit2/ethomson/tls
Restore tls v1.0 support temporarily
2024-12-18 22:25:06 +00:00
Edward Thomson
dc95ee2712 ssl: restore tls v1.0 support temporarily
Removing TLS v1.0 and v1.1 support is a bit of a breaking change; making
that change without any announcement or preparation is rather unkind.

Defer the TLS v1.2 requirement to the next version, but update the
cipher selection to the Mozilla backward compatibility list.
2024-12-18 21:04:07 +00:00
Edward Thomson
6aa9bc4a97 midx: add options to writer function
Provide an options structure to MIDX writing. This allows us to
specify information (like OID type) during writer creation.
2024-12-18 16:27:46 +00:00