Commit Graph

15374 Commits

Author SHA1 Message Date
Edward Thomson
15a8d8763e ci: make fedora a nightly build 2024-04-23 00:09:20 +01:00
Edward Thomson
64808a9a8e ci: fixes for fedora
Use fedora's valgrind instead of trying to build our own; omit false
positive leaks in getaddrinfo;
2024-04-23 00:07:48 +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
d396819101 http: abstract http parsing out of httpclient
Avoid #ifdef's in httpclient.c, and move http parsing into its own file.
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
Stephen Gallagher
06e384a0a4 Enable llhttp for HTTP parsing
Fixes: https://github.com/libgit2/libgit2/issues/6074

We now try to use llhttp by default, falling back to http-parser
if the former is not available.

As a last resort, we use the bundled http-parser.

Co-authored-by: Sergio Correia <scorreia@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Sergio Correia <scorreia@redhat.com>
2024-02-07 17:01:59 -05:00
Sergio Correia
00eb347068 ci: add fedora container and build
So that we can test a build with llhttp instead of http-parser.

Co-authored-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Sergio Correia <scorreia@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2024-02-07 17:00:49 -05:00
Edward Thomson
8535fdb9cb Merge pull request #6439 from russell/push-options
Implement push options on push
2024-02-07 11:31:24 +00:00
Edward Thomson
5f9e67a760 Merge pull request #6730 from libgit2/ethomson/revparse
Correct `git_revparse_single` and add revparse fuzzing
2024-02-06 21:40:53 +00:00
Edward Thomson
cbff31d033 Merge pull request #6729 from libgit2/ethomson/index_add
Correct index add directory/file conflict detection
2024-02-06 21:40:31 +00:00
Edward Thomson
85279f06aa ci: update push options tests
Keep the push options tests more constrained to our CI environment;
writing files within the test sandbox instead of outside of it. Provide
the path to the output file in the test data. In addition, add the
repository to the test resources instead of recreating the hooks every
time.
2024-02-06 20:40:38 +00:00
Edward Thomson
39669956fb push: "push_options" are now "remote_push_options"
Since we use `git_push_options` as the options structure to our
`git_push` command, much like we do everywhere else, "push_options"
becomes ambiguous. "remote_options" isn't much better for us. Call them
"remote_push_options", which is still quite bad, and not particularly
insightful for end users, but at least something that we can discuss
unambiguously.
2024-02-06 20:40:26 +00:00
Edward Thomson
b4263c2303 Merge remote-tracking branch 'origin/main' into push-options 2024-02-06 20:38:55 +00:00
Edward Thomson
18ea0b0773 index: correct index has_dir_name check
`has_dir_name` is used to check for directory/file collisions,
and attempts to determine whether the index contains a file with
a directory name that is a proper subset of the new index entry
that we're trying to add.

To determine directory name, the function would walk the path string
backwards to identify a `/`, stopping at the end of the string. However,
the function assumed that the strings did not start with a `/`. If the
paths contain only a single `/` at the beginning of the string, then the
function would continue the loop, erroneously, when they should have
stopped at the first character.

Correct the order of the tests to terminate properly.

Credit to Michael Rodler (@f0rki) and Amazon AWS Security.
2024-02-06 16:57:22 +00:00
Edward Thomson
56c98a07ed index: test adding two identical slash-prefix paths
Ensure that we can `git_index_add` a slash-prefixed path, followed by
re-adding the same path. The original entry should be replaced by the
new entry.
2024-02-06 16:57:22 +00:00
Edward Thomson
d353cf4897 revparse: fix parsing bug for trailing @
When parsing a revspec that ends with a trailing `@`, explicitly stop
parsing. Introduce a sentinel variable to explicitly stop parsing.

Prior to this, we would set `spec` to `HEAD`, but were looping on the
value of `spec[pos]`, so we would continue walking the (new) `spec`
at offset `pos`, looking for a NUL. This is obviously an out-of-bounds
read.

Credit to Michael Rodler (@f0rki) and Amazon AWS Security.
2024-02-06 16:56:30 +00:00
Edward Thomson
d41d321881 transport: safely handle messages with no caps
If there are no caps, don't try to advance past the first NULL to look
for object-format. This prevents a possible out-of-bounds read.
2024-02-06 16:56:30 +00:00
Edward Thomson
cef060a4f2 fuzzer: run address sanitization during fuzzing 2024-02-06 16:56:30 +00:00
Edward Thomson
f015996fe3 fuzzer: add a revparse fuzzer 2024-02-06 16:56:30 +00:00
Edward Thomson
8bd69574bd fuzzers: provide util functions like repo init
Many fuzzers will need to operate with a repository; extract the
repository initialization from downloads_refs_fuzzer.c into its own
utility area.
2024-02-06 16:56:30 +00:00
Edward Thomson
802f08c696 Merge pull request #6721 from vafada/ssh-timeout
set SSH timeout
2024-02-05 11:54:55 +00:00
Edward Thomson
c3dc87b0c8 docs: update documentation for timeout
The connect timeout *does* apply to SSH connections (at least libssh2),
so update the documentation appropriately.
2024-02-05 10:16:17 +00:00
Edward Thomson
f6d1cd7c3e Merge pull request #6727 from libgit2/ethomson/should_checkout_error
clone: don't swallow error in should_checkout
2024-02-04 22:35:42 +00:00
Edward Thomson
ca864c5914 clone: don't swallow error in should_checkout
When determining whether to check out a branch, we did not actually look
at `should_checkout`'s possible error condition. Disconnect the boolean
"should checkout" value from the potential error code so that it no
longer looks like a function that can be treated as if it returns a
boolean.
2024-02-04 14:40:47 +00:00
Mark
7be7c0c0e0 use git_socket_stream__timeout 2024-01-26 13:37:23 -05:00
Edward Thomson
9b2577f8e0 Merge pull request #6716 from libgit2/ethomson/commit
commit: introduce git_commit_create_from_stage
2024-01-26 10:35:37 +00:00
Mark
392e380463 set SSH timeout 2024-01-18 23:13:14 -05:00
Edward Thomson
55381816e8 commit: support specifying encoding for message 2024-01-15 15:53:19 +00:00
Edward Thomson
67a4d04b59 commit: introduce git_commit_create_from_stage
Provide a simple helper method that allows users to create a commit from
the current index with minimal information.
2024-01-15 15:53:19 +00:00
Edward Thomson
fddfca3526 tests: add cl_assert_equal_oidstr helper method 2024-01-15 00:15:10 +00:00
Edward Thomson
cf19ddc522 commit: fix const declaration
commit functions should take an array of const pointers, not a const
array.
2024-01-15 00:15:10 +00:00
Edward Thomson
048421a404 repo: add head_commit helper
Provide a helper method to provide the HEAD's commit, much like our
existing `head_tree` helper.
2024-01-15 00:15:10 +00:00
Edward Thomson
25e2b9d8c2 Merge branch 'safedir' 2024-01-14 01:06:49 +00:00
Edward Thomson
516749fe7d repo: simplify safe.directory comparison
Keep the `git_str` buf that prevents unnecessary small allocations, and
simplify the comparisons compared to what was there previously.
2024-01-14 01:06:05 +00:00
Edward Thomson
ff58b1699d Merge pull request #6715 from libgit2/ethomson/benchmarks
Benchmarks: add a site to view results
2024-01-12 10:50:47 +00:00
Edward Thomson
a79e48addb benchmarks: publish benchmarks as a static api 2024-01-12 09:57:16 +00:00
Edward Thomson
155eb67f28 benchmarks: use upload-artifact v3 2024-01-12 09:57:16 +00:00
Edward Thomson
45c8caad1c benchmarks: update name to be "libgit2" 2024-01-12 09:57:16 +00:00
Edward Thomson
ef53f20bd7 Merge pull request #6714 from DavHau/fixes
docs: fix mistake in attr.h
2024-01-11 17:27:05 +00:00
DavHau
d6454dd467 docs: fix mistake in attr.h
Also fix indentation
2024-01-11 16:34:36 +07:00
Edward Thomson
ea00310b09 Merge pull request #6707 from libgit2/ethomson/commit
Commit improvements
2024-01-10 02:06:06 +00:00
Edward Thomson
5d60731498 Merge pull request #6709 from libgit2/ethomson/nightly
Fix nightly builds
2024-01-10 02:03:57 +00:00
Edward Thomson
d15be592db ci: move docker container creation to an action 2024-01-10 01:45:15 +00:00
Edward Thomson
ee1d9a065a ci: actually push new build containers
When we update the build container, actually do a push. Remove the
broken build-containers.yml step and just do it in the workflow.
2024-01-10 01:45:15 +00:00
Edward Thomson
235f8e222d ci: update nightlies
There's been drift in our nightly builds vs our main builds.
Unfortunately, sharing steps remains clunky with our matrix-heavy setup.
So this remains copy-pasta.
2024-01-10 01:45:15 +00:00
Edward Thomson
0589ba6ccc ci: use newest libssh2 in bionic builds 2024-01-10 01:44:33 +00:00
Edward Thomson
98075baed2 fixup! commit: introduce git_repository_commit_parents 2023-12-23 15:30:31 +00:00
Edward Thomson
0572884693 commit: introduce git_repository_commit_parents
Emulating `git commit` is clunky - identifying your commit's parents is
part of the problem. Provide a helper to give you the parents given the
current repository state.
2023-12-23 14:11:26 +00:00
Edward Thomson
e2027c006b ci: add noble to build-container matrix 2023-12-23 13:43:48 +00:00