Commit Graph

2475 Commits

Author SHA1 Message Date
Edward Thomson
c2eafb2f6e checkpoint 2023-08-22 06:40:28 -04:00
Edward Thomson
ae3d81e2b8 wip - refactoring stream interface 2023-08-21 22:14:46 +01:00
Edward Thomson
75cc95110a streams: remove proxy idea
Streams don't have proxies. Remove this concept.
2023-08-21 22:14:45 +01:00
Edward Thomson
f89427acf4 errors: move systems things into the sys includes
Most callers only need to _get_ error messages. Only callers implemented
more complicated functions (like a custom ODB for example) need to set
them.

(Callback users should likely ferry their own error information in their
callback payload.)
2023-08-20 14:57:23 +01:00
Edward Thomson
f32c5c48c3 errors: never return a NULL error
Callers want to be able to simply call `git_error_last()->message`,
not have to worry about whether `git_error_last()` returns NULL or not.
2023-08-20 14:57:23 +01:00
Edward Thomson
45647b721c Merge pull request #6615 from libgit2/ethomson/config_origin
config: provide an "origin" for config entries
2023-08-14 20:40:47 +01:00
David Runge
f7c746a2ef fix: Add missing include for oidarray.
Add a missing include for `git2/oidarray.h` so build doesn't fail on
using `git_oidarray` when using custom transports.

Fixes #6607
2023-07-21 16:18:39 +02:00
Edward Thomson
40ce52e51f config: provide two memory-backed config backends
Provide two memory-backed configuration backends -- one that takes a
string in config file format `[section] key=value` and one that takes a
list of strings in `section.key=value` format.
2023-07-21 11:18:44 +01:00
Edward Thomson
0e0781f6f3 config: provide origin in git_config_entry
A git_config_entry now knows the type of the origin for the entry
("file", "memory", etc) and the path details (for files, the path on
disk). This is propagated through snapshots.
2023-07-20 10:29:41 +01:00
Edward Thomson
5f7c18d733 config: drop entry payload; teach config_list about entries
The opaque `payload` on an entry is unnecessary and distracting; config
entries should follow the patterns of other objects and use space
elsewhere in the structure with a "base" config entry struct embedded.
2023-07-19 13:35:45 +01:00
Edward Thomson
62498558ff meta: update version numbers to v1.8 2023-07-17 11:07:50 +01:00
Edward Thomson
bdd031576b v1.7: update version numbers 2023-07-17 10:33:15 +01:00
Edward Thomson
58be98b71b Merge pull request #6563 from libgit2/pks/test-allocator
tests: add allocator with limited number of bytes
2023-07-15 14:00:35 +01:00
Edward Thomson
12b54ae009 worktree: document that is_prunable sets error messages
When a worktree is not prunable, an error message will be set with
information about why. Document that.
2023-05-16 12:40:16 +01:00
Edward Thomson
9dd1bfe81c alloc: simplify pluggable allocators
Remove the number of functions that custom allocator users need to
provide; nobody should need to implement `substrdup`. Keep it to the
basics that are actually _needed_ for allocation (malloc, realloc,
free) and reimplement the rest ourselves.

In addition, move the failure check and error setting _out_ of the
custom allocators and into a wrapper so that users don't need to deal
with this. This also allows us to call our allocator (without the
wrapper) early so that it does not try to set an error on failure, which
may be important for bootstrapping.
2023-05-14 14:52:15 +01:00
Edward Thomson
fad9042897 streams: sockets are non-blocking and can timeout
Make socket I/O non-blocking and add optional timeouts.

Users may now set `GIT_OPT_SET_SERVER_CONNECT_TIMEOUT` to set a shorter
connection timeout. (The connect timeout cannot be longer than the
operating system default.) Users may also now configure the socket read
and write timeouts with `GIT_OPT_SET_SERVER_TIMEOUT`.

By default, connects still timeout based on the operating system
defaults (typically 75 seconds) and socket read and writes block.

Add a test against our custom testing git server that ensures that we
can timeout reads against a slow server.
2023-05-13 16:42:04 +01:00
Edward Thomson
4f76ef568d oid: don't assume thread local state was initialized
git_oid_tostr_s could fail if thread-local state initialization fails.
In that case, it will now return `NULL`.  Callers should check for
`NULL` and propagate the failure.
2023-05-13 14:09:25 +01:00
Edward Thomson
2bbcdee6b6 Merge pull request #6557 from libgit2/ethomson/shallow
Shallow (#6396) with some fixes from review
2023-05-09 20:38:04 +01:00
Edward Thomson
437c5f5a0b fetch: remove unshallow option
The `depth` field is suitable to specify unshallowing; provide an enum
to aide in specifying the `unshallow` value.
2023-05-09 17:14:08 +01:00
Edward Thomson
0a7e32b232 oid: use an oid array instead of shallowarray
Users should provide us an array of object ids; we don't need a separate
type. And especially, we should not be mutating user-providing values.
Instead, use `git_oid *` in the shallow code.
2023-05-09 17:14:08 +01:00
Edward Thomson
3388f5ba1b shallow: don't default to -1 for depth
Depth of `0` should indicate full depth. Disallow negative values (they
may have a future meaning) and use `0` as the default.
2023-05-08 15:06:41 +01:00
Edward Thomson
161d8a12e7 sha256: wrap_odb supports SHA256 2023-05-06 14:33:49 +01:00
Edward Thomson
dd15c615bd shallow: remove feature flag
The opt mechanism isn't _really_ meant to be for feature flags, and it's
weird to feature flag shallow / unshallow at all.
2023-04-24 11:49:12 +01:00
Edward Thomson
190a4c55df Merge remote-tracking branch 'origin/main' into shallow-clone-network 2023-04-22 23:17:32 +01:00
Edward Thomson
8a62616f43 Merge pull request #6549 from libgit2/ethomson/sha256_experimental
sha256: less hardcoded SHA1 types and lengths
2023-04-22 23:09:32 +01:00
Edward Thomson
3630883094 meta: the main branch is now v1.7.0 2023-04-12 12:06:22 +01:00
Edward Thomson
b899fda3d8 commit graph: support sha256 2023-04-10 14:21:16 +01:00
Edward Thomson
be484d355b midx: support sha256 2023-04-10 14:21:16 +01:00
Edward Thomson
db2a794dda diff: parse patches with sha256 2023-04-10 14:21:16 +01:00
Edward Thomson
523f893f6f index: add sha256 support 2023-04-10 11:02:12 +01:00
Edward Thomson
2173ca8a41 v1.6.3: update version numbers 2023-03-21 10:13:23 +00:00
lmcglash
e288f874a3 Remove unnecessary include. 2023-03-13 08:46:59 +00:00
lmcglash
e3bf6db55c Merge branch 'shallow-clone-network' of https://github.com/mathworks/libgit2 into shallow-clone-network 2023-03-10 09:30:35 +00:00
Laurence McGlashan
79ed94e0f8 Apply suggestions from code review
Co-authored-by: Qix <Qix-@users.noreply.github.com>
2023-03-10 09:30:29 +00:00
lmcglash
d935773743 Remove unused git_transport_flags_t 2023-03-10 09:30:02 +00:00
lmcglash
570ef74a07 Merge commit 'd066d0d95c43e97df6624292f3f527f9372ca8fe' 2023-03-10 08:51:43 +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
Tim Rogers
86b532de15 Correct the definition of "empty" in the docs for git_repository_is_empty
This improves the documentation for `git_repository_is_empty`
which currently does not accurately describe libgit2's definition
of "empty".

It says that HEAD must point to the "unborn master branch", when
in fact, this is not the case if the repo's `init.defaultBranch`
configuration is set. If it is set, it will check that HEAD points
there. Only if it is not set does it fall back to `master`.
2023-02-23 18:47:03 +00:00
Edward Thomson
d16b59c91e odb: don't unconditionally add oid_type to stream
`git_odb_stream` should have an `oid_type` to disambiguate; that's not
necessary on non-experimental SHA256 builds. Avoid unnecessary ABI
breakage for consumers and hide it behind an ifdef for now.
2023-02-23 14:03:16 +00:00
Edward Thomson
05ba3fe4e1 Merge pull request #6330 from gitkraken-jacobw/partial-stashing
stash: partial stash specific files
2023-02-16 10:23:28 +00:00
Edward Thomson
7c6df9e125 strarray: remove deprecated declaration
`git_strarray_copy` is deprecated (and has been included in
`deprecated.h` for some time). It should not have remained in
the public `strarray.h`. Remove it.
2023-02-16 09:49:27 +00:00
Edward Thomson
35580d88a8 stash: fixes from code review 2023-02-16 09:11:57 +00:00
Edward Thomson
80742e159c Merge pull request #6456 from libgit2/ethomson/sha256_experimental
SHA256: more SHA256 support
2023-02-14 17:01:23 +00:00
Edward Thomson
8eadeedee4 repo: take an oid_type when initializing 2023-02-12 22:02:00 +00:00
Edward Thomson
53fcd5b8f5 transport: teach transports about oid types and SHA256 2023-02-12 22:02:00 +00:00
Edward Thomson
fe2ee3a018 object: lookup sha256 objects
This is much of the plumbing for the object database to support SHA256,
and for objects to be able to parse SHA256 versions of themselves.
2023-02-12 22:02:00 +00:00
Edward Thomson
479c8c8c14 packfile: handle sha256 packfiles
Teach the packfile machinery to cope with SHA256.
2023-02-12 21:26:12 +00:00
Edward Thomson
acb00e4eae repo: understand the objectformat extension
Teach the repository about the `objectformat` extension, supporting
`sha1` always and `sha256` when the experimental sha256 support is
active.
2023-02-12 21:26:10 +00:00