Commit Graph

14742 Commits

Author SHA1 Message Date
Edward Thomson
d3f554fd67 Merge pull request #6435 from russell/capabilities-typo
transport: fix capabilities calculation
2023-01-20 22:30:57 +00:00
Edward Thomson
1845eac67c Merge pull request #6448 from libgit2/ethomson/action_versions
ci: update version numbers of actions
2023-01-20 22:29:54 +00:00
Edward Thomson
3ee86a3329 Merge commit 'e33d7c068' into ssh_key_checking 2023-01-20 22:13:14 +00:00
Edward Thomson
2d251184cc ci: update version numbers of actions 2023-01-20 21:35:15 +00:00
Edward Thomson
747af663fe README: show v1.5 and v1.4 branch builds 2023-01-20 21:32:18 +00:00
Edward Thomson
936b184e74 Merge pull request #6434 from tagesuhu/main
Fixes #6433: git_submodule_update fails to update configured but missing submodule
2022-11-28 13:16:58 +00:00
Russell Sim
be7356d0c6 transport: fix capabilities calculation
This looks like a typo to me, from what i can see these lines were
added at the same time and because of how capabilities are calculated,
it's likely that this code will work in situations where these
capabilities were the last ones.
2022-11-25 19:11:54 +01:00
tagesuhu
3f4b91b29d submodule: Do not try to update a missing submodule
If a submodule has been configured but not yet added, do not try to update it.

Issue #6433: git_submodule_update fails to update configured but missing submodule
2022-11-25 16:38:58 +00:00
tagesuhu
b57b7628d4 tests: Add new test to submodule::update
Verify that trying to update submodule which has been configured but not added does return an error.

Issue #6433: git_submodule_update fails to update configured but missing submodule
2022-11-25 16:32:39 +00:00
Edward Thomson
12832bab73 Merge pull request #6326 from libgit2/ethomson/url_parse
URL parsing for google-compatible URLs
2022-11-23 13:57:07 +00:00
Edward Thomson
d0203b6484 Merge pull request #6429 from csware/safe.directory-wildcard
Add support for "safe.directory *"
2022-11-23 13:53:40 +00:00
Edward Thomson
33e1c9853a Merge pull request #6413 from martinvonz/bsd-2-clause
add 2-clause BSD license to COPYING
2022-11-23 13:01:30 +00:00
Edward Thomson
8c7345e85a Merge pull request #6416 from slackner/httpclient_update_options
http: Update httpclient options when reusing an existing connection.
2022-11-23 13:00:23 +00:00
Sven Strickroth
594bd70b84 Add support for "safe.directory *"
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2022-11-19 12:00:43 +01:00
Edward Thomson
a7d841a8b1 Merge pull request #6421 from julianmesa-gitkraken/fix-leak-git_tag_create_from_buffer
Fix leak in git_tag_create_from_buffer
2022-11-18 13:56:59 +00:00
Edward Thomson
ad2d3a0696 Merge pull request #6408 from kcsaul/fix-safe-directory-not-found
Ignore missing 'safe.directory' config during ownership checks
2022-11-18 13:54:49 +00:00
Edward Thomson
e45b25eac3 Merge pull request #6420 from derrickstolee/commit-graph-hashing
commit-graph: only verify csum on git_commit_graph_open().
2022-11-18 13:51:18 +00:00
Derrick Stolee
6de3221deb commit_graph: use uint64_t for arithmetic
This should resolve some issues with UBSan builds by using unsigned
64-bit integers for all arithmetic until we finally convert to an offset
or size value.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-11-10 08:50:41 -05:00
Carlos Martín Nieto
e33d7c0688 ssh: look for a key in known_hosts to set the key type for the handshake
The server and client negotiate a single hostkey, but the "best" cipher may not
be the one for which we have an entry in `known_hosts`. This can lead to us not
finding the key in known_hosts even though we should be connecting.

Instead here we look up the hostname with a nonsense key to perform a lookup in
the known hosts and set that. This is roughly what the OpenSSH client does as
well.
2022-11-04 10:33:55 +01:00
Carlos Martín Nieto
a218f1bf74 tests: move online::clone::ssh_auth_methods into the ssh test suite
We're currently running it as part of the online suite but that doesn't have any
setup for ssh so we won't find the GitHub keys we set up during the test.

It doesn't need the private key setup as we just want to make sure we see some
auth request from the server, but with the addition of hostkey checking we're
now seeing it fail when we skip these tests.
2022-11-04 10:33:55 +01:00
Carlos Martín Nieto
c29651fe8b tests: append the github.com ssh keys so we have access during tests
Currently just the one test needs it.

The ssh-rsa makes sure we're asking for the cipher we find in `known_hosts` as
that won't be the one selected by default. This will be relevant in later changes.
2022-11-04 10:33:37 +01:00
Colin Stolley
2c4eb83ee1 commit-graph: only verify csum on git_commit_graph_open().
It is expensive to compute the sha1 of the entire commit-graph file each
time we open it. Git only does this if it is re-writing the file.

This patch will only verify the checksum when calling the external API
git_commit_graph_open(), which explicitly says it opens and verifies
the commit graph in the documentation.

For internal library calls, we call git_commit_graph_get_file(), which
mmaps the commit-graph file in read-only mode. Therefore it is safe to
skip the validation check there.

Tests were added to check that the validation works in the happy path,
and prevents us from opening the file when validation fails.

(Note from Derrick Stolee: This patch was applied internally at GitHub
after we recognized the performance impact it had during an upgrade of
libgit2. The original author left the company before we remembered to
send it upstream.)

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-11-03 12:09:18 -04:00
Julian Mesa
25dd1c93ab Missing dispose in git_tag_create__internal 2022-11-03 15:15:33 +01:00
Julian Mesa
a8b18f15a4 Missing dispose 2022-11-03 15:11:18 +01:00
Julian Mesa
c7e8de1712 Fix leak in git_tag_create_from_buffer
If the tag already exists and we are not forcing overwrite we need to free ref_name buffer before return the "tag already exists" error.
2022-11-03 14:46:42 +01:00
Carlos Martín Nieto
74c2b4b8a6 ssh: verify the remote's host key against known_hosts if it exists
It turns out this has been available in libssh2 for a long time and we should
have been verifying this the whole time.
2022-11-02 10:44:56 +01:00
Sebastian Lackner
f8683b7a93 http: Update httpclient options when reusing an existing connection.
Httpclient internally stores a copy of the certificate_check callback and
payload. When connecting via HTTPS, and if the server sends back
"Connection: close" after the first request, the following request would
attempt to re-use the httpclient and call the (now outdated) callback. In
particular for pygit2 this is a problem, since callbacks / payloads are only
valid for the duration of a libgit2 call, leading to a ffi.from_handle()
error and crashing the Python interpreter.
2022-10-20 03:04:56 +02:00
Edward Thomson
a3841af5ee benchmark: update path
The path to the default CLI output has changed, update it.
2022-10-18 13:11:19 +01:00
Martin von Zweigbergk
aa1605dd14 add 2-clause BSD license to COPYING
The `git_fs_path_basename_r()` function in `src/util/fs_path.c` says
it's based on Android code using the 2-clause BSD license, so I
suppose that means the COPYING file should include that.
2022-10-07 15:42:44 -07:00
Kevin Saul
93c071ac40 repo: ignore missing 'safe.directory' config during ownership checks 2022-10-01 17:08:49 +13:00
Kevin Saul
dd21e20ce2 repo: test ownership validation fails with expected error 2022-10-01 16:36:38 +13:00
Edward Thomson
9286e5991e Merge pull request #6405 from libgit2/ethomson/experimental
Support non-cmake builds with an in-tree `experimental.h`
2022-09-21 15:19:30 +01:00
Edward Thomson
c11724686c cmake: provide empty experimental.h for non-cmake users
Not everybody builds libgit2 using cmake; provide an `experimental.h`
with no experiments configured for those that do not. To support this,
we also now create compile definitions for experimental functionality,
to supplant that empty `experimental.h`. cmake will continue to generate
the proper `experimental.h` file for use with `make install`.
2022-09-19 06:34:51 -04:00
Edward Thomson
d78fad1519 Merge pull request #6395 from arroz/fix/nonexistent-worktree-lookup-error-code
#6366: When a worktree is missing, return GIT_ENOTFOUND.
2022-09-19 10:59:58 +01:00
Edward Thomson
c8d5b43bbc tests: skip sha256 tests when not compiled in
Actually `cl_skip` the sha256 tests when we're not compiled for sha256,
instead of passing them.
2022-09-19 05:38:18 -04:00
Edward Thomson
44b824854a Merge pull request #6369 from torvalds/main
Don't fail the whole clone if you can't find a default branch
2022-09-19 10:31:25 +01:00
Edward Thomson
d111cc9b62 Merge pull request #6398 from lrm29/patch-1
Delete create.c.bak
2022-09-19 10:18:04 +01:00
Edward Thomson
a54cc2bef4 Merge pull request #6382 from csware/fix_mem_leak
Fix memory leak
2022-09-19 10:17:02 +01:00
Edward Thomson
b075bda252 Merge pull request #6377 from Vinz2008/main
Fixes #6365 : Uppercase windows.h include fails build in case-sensitive OS
2022-09-19 10:16:12 +01:00
Edward Thomson
d959e75f7e Merge pull request #6373 from christoph-cullmann/fix_compile_WIN32_LEAN_AND_MEAN
fix compile on Windows with -DWIN32_LEAN_AND_MEAN
2022-09-19 10:13:28 +01:00
Edward Thomson
6ad26cdb4b Update src/util/rand.c 2022-09-19 05:13:12 -04:00
Edward Thomson
5250fa9ec2 Merge pull request #6363 from kcsaul/long_custom_header
winhttp: support long custom headers
2022-09-19 10:12:36 +01:00
Edward Thomson
cf326948b1 clone: test for cloning a repo with namespace scope
Test that we can successfully clone a repository that is namespace
scoped on the remote and does not advertise a HEAD. To do this, we must
specify the branch to checkout.
2022-09-19 05:07:16 -04:00
Edward Thomson
9d9a90ad3d clone: test bare clone namespaced repo with no HEAD
Test that we can successfully clone a repository that is namespace
scoped to a bare repository locally. We need not specify a checkout
branch in this case (obviously, since we do not check anything out in a
bare clone).
2022-09-19 05:07:16 -04:00
Edward Thomson
c928d96ea4 clone: narrow success tests on HEAD-less remotes
Only allow the remote default branch checking to fail when the remote
default branch doesn't exist (`git_remote__default_branch` returns
`GIT_ENOTFOUND`). If there was any other type of error - for example, an
allocation failure - we should not swallow that and continue to fail.

This allows us to support the case when a remote has not advertised a
HEAD -- this is possible, for example, when the remote has constrained
the caller to a particular namespace. But other remote failures remain
as failures.
2022-09-19 05:07:16 -04:00
Edward Thomson
ed27768458 Merge remote-tracking branch 'origin/main' into clone_namespace 2022-09-19 05:07:12 -04:00
Edward Thomson
71071360e1 Merge pull request #6403 from libgit2/ethomson/ci
CI Improvements
2022-09-16 16:21:00 +01:00
Edward Thomson
ebb0830c65 ci: clean up daemon processes on exit
We previously (correctly) cleaned up the git daemon and SSH server, but
failed to clean up our bespoke HTTP server and HTTP proxies. Capture
their PIDs on process creation and kill them when we shut down.
2022-09-16 10:46:18 -04:00
Edward Thomson
ec1aec36b3 ci: move to macos-11
GitHub has deprecated macOS 10.15; move to their new macOS 11 build
servers.
2022-09-16 10:24:35 -04:00
Laurence McGlashan
937d8f8479 Delete create.c.bak 2022-09-06 15:59:50 +01:00