35 Commits

Author SHA1 Message Date
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
338ceb93b6 Improve documentation 2024-11-26 21:44:09 +00: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
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
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
53fcd5b8f5 transport: teach transports about oid types and SHA256 2023-02-12 22:02:00 +00:00
yuangli
68bbcefd35 Merge branch 'transportPR' into shallow-clone-network 2022-07-29 13:19:33 +01:00
yuangli
afa79ca058 Merge branch 'pr/tiennou/4747' into transportPR 2022-07-04 17:08:04 +01:00
Edward Thomson
cc4c37ca9e transport: remove git_transport_smart_proxy_options
Snuck in during refactoring; let's get rid of it.
2022-06-12 10:50:43 -04:00
lhchavez
a75416761c Apply suggestions from code review
Co-authored-by: Edward Thomson <ethomson@github.com>
2022-06-11 14:29:15 -07:00
lhchavez
1d88605ca9 transport: introduce git_transport_smart_remote_connect_options
6fc6eeb66c removed
`git_transport_smart_proxy_option`, and there was nothing added to
replace it. That made it hard for custom transports / smart
subtransports to know what remote connect options to use (e.g. proxy
options).

This change introduces `git_transport_smart_remote_connect_options` to
replace it.
2022-04-16 08:23:22 -07:00
Edward Thomson
923c16527c transport: add capabilities query function 2022-02-06 15:01:15 -05:00
Edward Thomson
6fc6eeb66c remote: introduce git_remote_connect_options
The existing mechanism for providing options to remote fetch/push calls,
and subsequently to transports, is unsatisfactory.  It requires an
options structure to avoid breaking the API and callback signatures.

1. Introduce `git_remote_connect_options` to satisfy those needs.

2. Add a new remote connection API, `git_remote_connect_ext` that will
   take this new options structure.  Existing `git_remote_connect` calls
   will proxy to that.  `git_remote_fetch` and `git_remote_push` will
   proxy their fetch/push options to that as well.

3. Define the interaction between `git_remote_connect` and fetch/push.
   Connect _may_ be called before fetch/push, but _need not_ be.  The
   semantics of which options would be used for these operations was
   not specified if you specify options for both connect _and_ fetch.
   Now these are defined that the fetch or push options will be used
   _if_ they were specified.  Otherwise, the connect options will be
   used if they were specified.  Otherwise, the library's defaults will
   be used.

4. Update the transports to understand `git_remote_connect_options`.
   This is a breaking change to the systems API.
2022-01-06 15:18:33 -05:00
Peter Pettersson
38c3449822 Make enum in includes C90 compliant by removing trailing comma. 2021-11-15 16:45:40 +01:00
Etienne Samson
3e17854782 docs: fix some missing includes that cause Docurium to error out 2021-05-27 16:26:38 +02:00
Edward Thomson
3f54ba8b61 credential: change git_cred to git_credential
We avoid abbreviations where possible; rename git_cred to
git_credential.

In addition, we have standardized on a trailing `_t` for enum types,
instead of using "type" in the name.  So `git_credtype_t` has become
`git_credential_t` and its members have become `GIT_CREDENTIAL` instead
of `GIT_CREDTYPE`.

Finally, the source and header files have been renamed to `credential`
instead of `cred`.

Keep previous name and values as deprecated, and include the new header
files from the previous ones.
2020-01-26 18:39:41 +00:00
Edward Thomson
a1ef995dc0 indexer: use git_indexer_progress throughout
Update internal usage of `git_transfer_progress` to
`git_indexer_progreses`.
2019-02-22 11:25:14 +00:00
Etienne Samson
9fd9126ee7 docs: minor changes 2019-01-30 21:19:18 +01:00
Etienne Samson
f6412c26c1 transport: enhance documentation 2019-01-28 13:05:52 +01:00
Edward Thomson
22d2062d95 Introduce GIT_CALLBACK macro to enforce cdecl
Since we now always build the library with cdecl calling conventions,
our callbacks should be decorated as such so that users will not be able
to provide callbacks defined with other calling conventions.

The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as
appropriate.
2019-01-17 21:17:32 +00:00
Edward Thomson
8ee1009874 transport: see if cert/cred callbacks exist before calling them
Custom transports may want to ask libgit2 to invoke a configured
credential or certificate callback; however they likely do not know if a
callback was actually configured.  Return a sentinal value
(GIT_PASSTHROUGH) if there is no callback configured instead of crashing.
2018-11-15 09:08:15 +00:00
Carlos Martín Nieto
5c76096046 transport: provide a getter for the proxy options
As with the callbacks, third-party implementations of smart subtransports cannot
reach into the opaque struct and thus cannot know what options the user set.

Add a getter for these options to copy the proxy options into something external
implementors can use.
2017-04-17 13:03:03 +02:00
Carlos Martín Nieto
07bd3e57d9 proxy: ask the user for credentials if necessary 2016-04-19 13:54:19 +02:00
Leo Yang
bf28da4718 Fix build for custom transport users
We should explicitly include the declaration of git_strarray
from "include/git2/sys/transport.h"
2015-10-30 14:17:11 -04:00
Matt Burke
4f2b6093a6 Tell the git_transport about the custom_headers 2015-09-08 14:02:33 -04:00
Carlos Martín Nieto
47ed7e5acd transport: provide a way to get the callbacks
libgit2 implementations of smart subtransports can simply reach through
the structure, but external implementors cannot.

Add these two functions as a way for the smart subtransports to get the
callbacks as set by the user.
2015-08-19 02:23:18 +02:00
Carlos Martín Nieto
058b753ceb remote: move the transport ctor to the callbacks
Instead of having it set in a different place from every other callback,
put it the main structure. This removes some state from the remote and
makes it behave more like clone, where the constructors are passed via
the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
8f0104ecc5 Remove the callbacks struct from the remote
Having the setting be different from calling its actions was not a great
idea and made for the sake of the wrong convenience.

Instead of that, accept either fetch options, push options or the
callbacks when dealing with the remote. The fetch options are currently
only the callbacks, but more options will be moved from setters and
getters on the remote to the options.

This does mean passing the same struct along the different functions but
the typical use-case will only call git_remote_fetch() or
git_remote_push() and so won't notice much difference.
2015-05-13 09:46:35 +02:00
Leo Yang
142e5379ca Add a custom param to git_smart_subtransport_definition
The smart transport has already take the payload param. For the
sub transport a payload param is useful for the implementer.
2015-03-18 13:15:21 -04:00
Carlos Martín Nieto
a295bd2dc4 doc: add documentation to all the public structs and enums
This makes them show up in the reference, even if the text itself isn't
the most descriptive.

These have been found with

    grep -Przon '\n\ntypedef struct.*?\{' -- include
    grep -Przon '\n\ntypedef enum.*?\{' -- include
2014-12-06 03:44:40 +01:00
Will Stamper
b874629b2d Spelling fixes 2014-12-04 21:06:59 -06:00
Carlos Martín Nieto
41698f22f6 net: remove support for outright ignoring certificates
This option make it easy to ignore anything about the server we're
connecting to, which is bad security practice. This was necessary as we
didn't use to expose detailed information about the certificate, but now
that we do, we should get rid of this.

If the user wants to ignore everything, they can still provide a
callback which ignores all the information passed.
2014-09-16 17:01:32 +02:00
Carlos Martín Nieto
9b9405865e Provide a callback for certificate validation
If the certificate validation fails (or always in the case of ssh),
let the user decide whether to allow the connection.

The data structure passed to the user is the native certificate
information from the underlying implementation, namely OpenSSL or
WinHTTP.
2014-09-16 17:01:30 +02:00
Edward Thomson
c180c06586 Custom transport: minor cleanups
* Move the transport registration mechanisms into a new header under
   'sys/' because this is advanced stuff.
 * Remove the 'priority' argument from the registration as it adds
   unnecessary complexity.  (Since transports cannot decline to operate,
   only the highest priority transport is ever executed.)  Users who
   require per-priority transports can implement that in their custom
   transport themselves.
 * Simplify registration further by taking a scheme (eg "http") instead
   of a prefix (eg "http://").
2014-08-14 08:52:20 -05:00