Commit Graph

2620 Commits

Author SHA1 Message Date
Eric Huss
b4ad6ffae6 Update documentation to clarify that cert cb is always called
This removes the phrase "if cert verification fails" because the
certificate callback is *always* called whether it fails or not. This
was changed in
17491f6e56,
but presumably this piece of documentation was not updated.
2025-08-12 10:12:59 -07:00
Edward Thomson
a9ae10c32d transport: update registration docs
The documentation for `git_transport_register` erroneously stated that
the trailing `://` was required for the scheme. It is not.
2025-06-06 21:18:51 +01:00
Edward Thomson
3082736857 Merge pull request #7059 from georgthegreat/circular-includes
Fix circular includes between types.h and oid.h
2025-06-05 13:11:20 +01:00
Dominique Fuchs
00e1550a23 docs: correct docstring info for git_remote_url
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2025-05-16 15:00:53 +02:00
Yuriy Chernyshov
60fdf919e7 Fix circular includes between types.h and oid.h 2025-03-31 13:04:34 +03:00
Edward Thomson
3822833a7a Merge pull request #7007 from libgit2/ethomson/buildinfo
Introduce git_libgit2_buildinfo
2025-02-03 17:20:55 +00:00
Edward Thomson
24b5096712 Include common.h in version.h
Fixes #7027
2025-01-23 00:22:34 +00:00
Edward Thomson
1509637751 Introduce git_libgit2_buildinfo
Track some information about the compilation at compile time, and allow
consumers to query it.
2025-01-15 09:28:26 +00:00
Edward Thomson
23da3a8f3c object: remove OFS_DELTA and REF_DELTA values
Deltas are not objects, they're entries in a packfile. Remove them from
the object enum.
2025-01-03 13:28:19 +00:00
Edward Thomson
2d5942571c object: introduce type_is_valid
There's no such thing as a "loose object type" or a "packed object
type". There are only object types. Introduce `type_is_valid` and
deprecate `typeisloose`.
2025-01-03 13:28:19 +00:00
Florian Pircher
2fa13adf09 include: Fix code comment termination 2025-01-02 17:19:58 +01:00
Edward Thomson
c26d8a8b54 sha256: further API simplifications for OID parsing
Introduce `git_oid_from_string`, `git_oid_from_prefix`, and
`git_oid_from_raw`, all of which take a `git_oid_t` that indicates what
type of OID should be parsed (SHA1 or SHA256).

This allows users to continue to use `git_oid_fromstr` without any code
changes, while remaining in a SHA1 world.

Note that these are not perfect analogs to the `fromstr` APIs.

* `git_oid_from_string` now takes a NUL terminated string, instead of
  allowing for non-NUL terminated strings. Adding a NUL check feels like
  an important safety consideration for C strings.
* `git_oid_from_prefix` should be used for an OID substring and length.

Previous usages of `git_oid_fromstr` with non-NUL terminated strings
should move to `git_oid_from_prefix` with the hexsize for the given OID
type.
2025-01-02 13:13:59 +00:00
Edward Thomson
56e2a85643 sha256: simplify API changes for sha256 support
There are several places where users may want to specify the type of
object IDs (sha1 or sha256) that should be used, for example, when
dealing with repositories, indexes, etc.

However, given that sha256 support remains disappointingly uncommon in
the wild, we should avoid hard API breaks when possible. Instead, update
these APIs to have an "extended" format (eg, `git_odb_open_ext`) that
provides an options structure with oid type information.

This allows callers who do care about sha256 to use it, and callers who
do not to avoid gratuitous API breakage.
2025-01-02 13:13:59 +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
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
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
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
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
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
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
Edward Thomson
0738b054d3 commit_graph: add opts to open function
Provide an options structure to commit graph opening. This allows us to
specify information (like OID type) during opening.
2024-12-18 16:27:46 +00:00
Edward Thomson
54d666e5f7 commit_graph: move opts to new function
Instead of making the commit and dump functions take individual options
structures; provide the options structure to the writer creator. This
allows us to add additional information (like OID type) during
generation.
2024-12-18 16:27:46 +00:00
Edward Thomson
622035e6ad repo: take an options structure for repository_new
Future-proof the SHA256-ification of `git_repository_new` by taking an
options structure instead of an oid type.
2024-12-18 16:27:46 +00:00
Edward Thomson
43c31ecc42 repo: don't require oid_type to wrap_odb
The `wrap_odb` function doesn't need to know the OID types in the object
database; the object database already knows the type.
2024-12-18 16:27:46 +00:00
Edward Thomson
cefcabfcc1 repo: specify odb options to odb_wrap
odb wrapping
2024-12-18 16:27:46 +00:00
Edward Thomson
9aa5faa38b indexer: move oid_type into the opts structure
Object ID type should be an option within the options structure; move it
there.
2024-12-18 16:27:46 +00:00
Edward Thomson
708d64f1e8 index: provide a index_options structure when opening
Instead of simply taking the oid type, future-proof our index opening
and creation functionality by taking an options structure.
2024-12-18 16:12:21 +00:00
Ryan Pham
3d9f4061ca refspec: Add func to distinguish negative refspecs
Negative refspecs were added in Git v2.29.0 and are denoted by prefixing
a refspec with a caret. This adds a way to distinguish if a refspec is
negative and match negative refspecs.
2024-12-17 09:23:28 +09:00
Edward Thomson
f675ea3cd7 docs: remind people about git_libgit2_init
Currently `git_libgit2_init` must be called before you can work with the
library. Remind people about this as they read the documentation.
2024-12-11 10:54:21 +00:00
Edward Thomson
455ce40994 Make GIT_WIN32 an internal declaration
The `GIT_WIN32` macro should only be used internally; keep it as such.
2024-12-09 23:36:34 +00:00
Edward Thomson
4282cbd6d8 Merge remote-tracking branch 'main' into mempack_empty 2024-12-09 22:38:29 +00:00
Edward Thomson
4bb69b0827 odb_mempack: use an out param 2024-12-09 22:36:10 +00:00
Edward Thomson
88fee7af56 Documentation: update refdb_backend docs
Parameters are documented by `@param`, not `@arg`
2024-12-09 21:52:44 +00:00
Edward Thomson
338ceb93b6 Improve documentation 2024-11-26 21:44:09 +00:00
Edward Thomson
5353a2cc20 reflog: remove unused sys functions
The `git_reflog_entry__alloc` function is not actually defined, nor
used. Remove references to it in the headers. It is not clear why the
corresponding `__free` is, or should be, exported. Make it internal to
the library.
2024-11-26 21:22:10 +00:00
Caleb Owens
d2f5ce220c Update documentation of merge_base_many 2024-10-23 19:10:39 +01:00
Vladyslav Yeremeichuk
b190162f3e Add the ability to get the number of objects in mempack
Implement git_mempack_object_count, which returns the number of
objects in mempack and -1 on error.
2024-10-22 13:58:10 +03:00
Vladyslav Yeremeichuk
d1be60bbe8 Add the ability to check if a mempack is empty
Implement git_mempack_empty, which returns 1 if the mempack is empty
and 0 otherwise.
2024-10-21 22:42:56 +03:00
Edward Thomson
1692d30809 Merge pull request #6559 from libgit2/ethomson/update_tips_spec
remote: add update_refs with git_refspec
2024-10-20 00:04:52 +01:00
Edward Thomson
c1b2b25ebc remote: add update_refs callback
Add an `update_refs` callback that includes the refspec; `update_tips`
is retained for backward compatibility.
2024-10-19 23:42:26 +01:00
Edward Thomson
69555048fd clone: refactor to pass clone options around
Instead of dealing with the clone options sub-options (fetch, checkout,
etc) individually, treat them as a cohesive whole when passing them
throughout the system.

Additionally, move some functions around within the file to avoid
unnecessary decls at the top of the file.  And change a function
signature to avoid conflating truth with error.
2024-10-19 23:01:35 +01:00
Edward Thomson
933b62eedf checkout: make safe checkout the default
Make `GIT_CHECKOUT_SAFE` the default.  `NONE` is never what the user
wants _by default_; people expect checkout to, well, check things out.
Instead, it should be an opt-in "dry run" mode.

This removes some odd code in internal callers of `checkout` that takes
a `git_checkout_options` and updates the mode to `SAFE`.  This is now
unnecessary since everything has better defaults.
2024-10-19 23:01:35 +01:00
GravisZro
f1cac063ba Mandate C90 conformance
This PR ensures and enforces C90 conformance for all files C, including tests.

* Modify CMakeLists.txt to mandate C90 conformance (for better compiler compatibility)
* Update deps/ntlmclient/utf8.h to latest version
* Modify two tests and one header to use C comments instead of C++ comments
2024-10-18 22:26:57 +01:00
Edward Thomson
1ee2c33993 blame: provide line accessor
blame: introduce git_blame_line

Provide a structure that can provide the line-level information.
2024-10-18 10:02:02 +01:00
Edward Thomson
49402cc614 blame: add commit summary information 2024-10-18 10:02:02 +01:00
Edward Thomson
5378b80a9f blame: add final committer information
Our blame implementation tracks final _author_ but not final
_committer_. Make it so.
2024-10-18 10:02:02 +01:00
Edward Thomson
9cea29d154 blame: update API
Use `size_t` for sizes, standardize naming with the rest of the library.
2024-10-18 10:02:02 +01:00
John Colvin
c2d697e3ce s/size on bytes/size in bytes/ 2024-10-16 14:55:12 +01:00
Edward Thomson
751c68f1b6 Merge pull request #6877 from yerseg/ability_to_add_custom_x509_certs
ssl: ability to add raw X509 certs to the cert store
2024-10-02 13:09:31 +01:00
Edward Thomson
fa5b832544 openssl: point out the interaction between certs
The OpenSSL certificate setting functions _may_ interact; try to
document that a bit better.
2024-10-01 20:53:59 +01:00