Commit Graph

237 Commits

Author SHA1 Message Date
Edward Thomson
338ceb93b6 Improve documentation 2024-11-26 21:44:09 +00: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
2d649ccd23 remote: drop bitfields in git_remote_fetch_options
In attempting to make a clever change that added fetch options as flags,
while keeping ABI and API compatibility, we screwed up. Bitfields in
structs are implementation-specific and are not necessarily ABI
compatible across compilers.

Make `update_fetchhead` a flags value which is weirdly named, but
that's a future problem. This removes the `report_unchanged` option from
API.
2024-05-06 15:46:21 +01:00
Edward Thomson
2eb3fecd03 fetch: avoid API breaking-changes from v1.7
Update `git_fetch_options` to break out the fetch options into
individual options. This prevents creating an API breaking change from
v1.7.0. `git_remote_update_tips` retains the `update_flags` to also
avoid an API breaking change.
2024-03-17 21:26:27 +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
95e517bee5 remote: optionally report unchanged tips 2023-10-15 14:15:20 +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
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
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
Russell Sim
ecc6f2fb83 push: support push-options
Push options are an optional capability of a git server.  If they are
listed in the servers capabilities, when the client lists push-options
in it's list of capabilities, then the client sends it's list of push
options followed by a flush-pkt.

So, If we have any declared push options, then we will list it as a
client capability, and send the options.

If the request contains push options but the server has no push
options capability, then error.
2022-11-27 00:17:32 +01:00
yuangli
49e641be8c remove unused api 2022-08-11 09:32:28 +01:00
yuangli
df5eb3239b support fetch unshallow option on shallow repos 2022-08-09 19:24:57 +01:00
yuangli
2d33fe7885 refactor git_fetch_option.depth and usage 2022-08-02 13:15:22 +01:00
yuangli
73d25f0e7b remove build errors 2022-07-29 13:53:29 +01: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
258df9c18d Merge pull request #6168 from punkymaniac/patch-documentation-2
Improve documentation
2022-01-17 22:03:26 -05:00
Edward Thomson
515daeaf4d remote: introduce follow_redirects connect option
Give callers the ability to select how to handle redirects - either
supporting redirects during the initial connection (so that, for
example, `git.example.com/repo` can redirect to `github.com/example/repo`)
or all/no redirects.  This is for compatibility with git.
2022-01-13 21:34:20 +00:00
punkymaniac
68bc511abb Add documentation about parameter and return value 2022-01-09 10:17:51 +01: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
punkymaniac
379c46463c Fix coding style for pointer
Make some syntax change to follow coding style.
2021-09-09 19:49:04 +02:00
lhchavez
62ee779ea4 remote: Mark git_remote_name_is_valid as GIT_EXTERN
This change makes `git_remote_name_is_valid` be part of the public
interface of the library. This is needed for other language bindings to
be able to find this symbol (like in git2go, when linking against
libgit2 dynamically).
2021-09-04 18:02:17 -07:00
Edward Thomson
7442c000d9 remote: deprecate resolve_url callback
Using a callback to set a resolve_url is not particularly idiomatic.
Deprecate it in favor of the `set_instance_url` and
`set_instance_pushurl` functions which can now be called from the
`git_remote_ready_cb` callback.
2021-08-29 10:39:28 -04:00
Edward Thomson
72df17c659 remote: introduce git_remote_ready_cb
Introduce a new callback that fires when the remote is ready to connect.
2021-08-29 10:39:28 -04:00
Edward Thomson
672406773e remote: introduce set_instance_url
Users may want to override the URL on a particular instance of a remote,
instead of updating the configuration.  Previously, users could use a
callback to do this, but this is not particularly idiomatic.
2021-08-27 11:26:49 -04:00
punkymaniac
48e3c25b93 Add missing return documentation 2021-07-06 17:39:59 +02:00
punkymaniac
aefbd18948 Add missing empty line 2021-07-06 17:39:59 +02:00
punkymaniac
c960e0b1eb Fix bad char at the end of the word 2021-07-06 17:39:58 +02:00
Edward Thomson
c7143d7ce4 remote: deprecate git_remote_is_valid_name 2020-10-25 16:33:28 +00:00
Edward Thomson
023ebb9a8e refs: introduce git_remote_name_is_valid
Provide a function that can check remote name validity but can also
signal when an error occurs.  Use the name "name_is_valid", which is
more suggestive of checking a given name, rather than "is_valid_name",
which suggests that the function checks the validity of the current
remote's name.
2020-10-25 16:33:27 +00:00
Patrick Steinhardt
aa4cd778b9 Merge pull request #5336 from libgit2/ethomson/credtype
cred: change enum to git_credential_t and GIT_CREDENTIAL_*
2020-01-30 10:40:44 +01: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
82154e586c remote functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Etienne Samson
33448b4519 docs: More of it 2019-06-26 15:49:37 +02:00
Etienne Samson
764196fffb doc: add missing documentation comments 2019-06-15 16:15:50 +02:00
Edward Thomson
0b5ba0d744 Rename opt init functions to options_init
In libgit2 nomenclature, when we need to verb a direct object, we name
a function `git_directobject_verb`.  Thus, if we need to init an options
structure named `git_foo_options`, then the name of the function that
does that should be `git_foo_options_init`.

The previous names of `git_foo_init_options` is close - it _sounds_ as
if it's initializing the options of a `foo`, but in fact
`git_foo_options` is its own noun that should be respected.

Deprecate the old names; they'll now call directly to the new ones.
2019-06-14 09:57:00 +01:00
Erik Aigner
59647e1ad0 remote: add callback to resolve URLs before connecting
Since libssh2 doesn't read host configuration from the config file,
this callback can be used to hand over URL resolving to the client
without touching the SSH implementation itself.
2019-05-21 14:11:08 +02:00
Edward Thomson
2dd5a42941 remote: Rename git_remote_completion_type to _t
For consistency with other "type" enums, rename
git_remote_completion_type to git_remote_completion_t.
2019-02-25 13:17:58 +00:00
Edward Thomson
59001e8305 remote: rename git_push_transfer_progress callback
The `git_push_transfer_progress` is a callback and as such should be
suffixed with `_cb` for consistency.  Rename
`git_push_transfer_progress` to `git_push_transfer_progress_cb`.
2019-02-22 11:25:14 +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
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
Etienne Samson
d365029406 remote: add a flag to prevent generation of the default fetchspec 2018-11-02 14:58:12 +01:00
Etienne Samson
fdb116b364 remote: add a creation flag for ignoring url.insteadOf 2018-11-02 14:58:12 +01:00
Etienne Samson
3cbaebdf7d remote: provide a generic API for creating remotes
This supersedes the functionality of remote_create_with_fetchspec, remote_create_anonymous and remote_create_detached.
2018-11-02 14:58:12 +01:00
Etienne Samson
9890f0594c push: make the parallelism default follow the docs 2018-08-29 22:52:29 +02:00
Etienne Samson
ca5a15e51b docs: standardize comment block for git_*_init_options functions 2018-05-07 21:50:38 +02:00
Carson Howard
e6c720ea17 remote/proxy: fix git_transport_certificate_check_db comment 2018-03-27 10:05:21 -07:00
Carson Howard
7138ce370b remote: add typedef to normalize push_update_reference callback
Very many callbacks in libgit2 have some sort of typedef to normalize the name at git_<name_of_operation>_cb. Add a typedef for push_update_references in the remote so the name follows the same conventions.
2017-10-06 07:16:26 -07:00