summaryrefslogtreecommitdiff
path: root/src/remote.c
Commit message (Collapse)AuthorAgeFilesLines
* refactor: `src` is now `src/libgit2`Edward Thomson2022-02-221-3084/+0
|
* remote: do store the update_tips callback error valueCarlos Martín Nieto2022-02-211-1/+1
| | | | | | | | We use `git_error_set_after_callback_function` to determine whether `update_tips` returned an error but do not store its return value making us think it always returns 0. Fix it by adding the common patter of storing it inside the `if` when calling it.
* fetch: support oids in fetch specsEdward Thomson2022-02-061-1/+31
|
* fetch: add a test for local fetchingEdward Thomson2022-02-061-1/+3
|
* remote: introduce git_remote_capabilitiesEdward Thomson2022-02-061-0/+14
| | | | | Provide a mechanism for (internal) users to determine a remote's capabilities from the transport.
* remote: refactor update tips functionEdward Thomson2022-02-051-100/+118
| | | | | | Move the functionality to update an individual tip out of the loop; although the update tip function remains rather gnarly, at least the outer function is a bit less onerous.
* remote: refactor ref updatingEdward Thomson2022-02-051-25/+39
| | | | Pull ref updating into its own function for future uses.
* remote: honor `http.followRedirects` configuration optionEdward Thomson2022-01-131-16/+63
|
* remote: introduce `follow_redirects` connect optionEdward Thomson2022-01-131-0/+1
| | | | | | | 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.
* remote: introduce `git_remote_connect_options`ethomson/remote_connect_optsEdward Thomson2022-01-061-115/+264
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* remote: improved error reportingEdward Thomson2022-01-061-1/+1
| | | | | Several places in the remote code identify an error and then swallow it; return the error.
* remote: refactor insteadof applicationethomson/insteadofEdward Thomson2021-12-231-34/+28
| | | | | | | Using the insteadof helper would leak memory when we didn't really want the pushInsteadOf configuration. Refactor the choice into the function that allocates memory (or now, not) and use a more idiomatic `int` return code.
* remote: improve apply_insteadof function signatureMartin Kühl2021-11-111-9/+9
|
* fix remote/insteadof testsMartin Kühl2021-11-111-5/+25
|
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-171-177/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
* Update remote.cLaurence McGlashan2021-09-181-1/+1
| | | Initialise cfg variable.
* Apply suggestions from code reviewLaurence McGlashan2021-09-181-7/+2
| | | Co-authored-by: Edward Thomson <ethomson@github.com>
* Allow proxy options when connecting with a detached remote.Laurence McGlashan2021-09-161-3/+15
|
* Fix coding style for pointerpunkymaniac2021-09-091-1/+1
| | | | Make some syntax change to follow coding style.
* remote: refactor proxy detectionEdward Thomson2021-09-011-110/+94
| | | | | | | | | | Update the proxy detection for a remote. 1. Honor `http.<url>.proxy` syntax for a remote's direct URL and parent URLs. 2. Honor an empty configuration URL to override a proxy configuration. Add tests to ensure that configuration specificity is honored.
* Add NO_PROXY env supportMathieu Parent2021-09-011-6/+87
| | | | | | Item 2 of 3 from #4164 Signed-off-by: Mathieu Parent <math.parent@gmail.com>
* remote: deprecate resolve_url callbackethomson/custom_urlEdward Thomson2021-08-291-3/+16
| | | | | | | 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.
* remote: introduce git_remote_ready_cbEdward Thomson2021-08-291-3/+12
| | | | Introduce a new callback that fires when the remote is ready to connect.
* remote: introduce set_instance_urlEdward Thomson2021-08-271-0/+32
| | | | | | 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.
* skip descendant check if remote ref not foundAlex Good2021-08-051-1/+3
|
* Respect the force flag on refspecs in git_remote_fetchAlex Good2021-06-111-0/+3
|
* Fix some typosAaron Franke2021-02-151-3/+3
|
* remote: don't update invalid refsEdward Thomson2021-01-071-0/+10
| | | | | If a symbolic reference points to something invalid, then do not try to update it.
* remote: use GIT_ASSERTEdward Thomson2020-11-271-36/+45
|
* buffer: git_buf_sanitize should return a valueEdward Thomson2020-11-251-3/+7
| | | | | | `git_buf_sanitize` is called with user-input, and wants to sanity-check that input. Allow it to return a value if the input was malformed in a way that we cannot cope.
* remote: deprecate git_remote_is_valid_nameEdward Thomson2020-10-251-8/+14
|
* remote: use git_remote_name_is_validEdward Thomson2020-10-251-2/+4
|
* refs: introduce git_remote_name_is_validEdward Thomson2020-10-251-7/+25
| | | | | | | | 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.
* refspec: return GIT_EINVALIDSPEC for invalid specsEdward Thomson2020-10-251-5/+1
| | | | | | | Disambiguate invalid specifications in `git_refspec__parse` so that callers can determine the difference between invalid specifications and actual errors. No call sites wil propagagte this new error message to an end-user, so there is no user-facing API change.
* refs: use git_reference_name_is_validEdward Thomson2020-10-251-3/+10
|
* remote: update the default remote branchEdward Thomson2020-08-031-14/+27
| | | | | | When the remote does not tell us its default, we have to guess what the default branch should be. Use our local initial branch configuration to inform the remote branch default when we clone.
* tree-wide: do not compile deprecated functions with hard deprecationPatrick Steinhardt2020-06-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h" header to be empty. As a result, no function declarations are made available to callers, but the implementations are still available to link against. This has the problem that function declarations also aren't visible to the implementations, meaning that the symbol's visibility will not be set up correctly. As a result, the resulting library may not expose those deprecated symbols at all on some platforms and thus cause linking errors. Fix the issue by conditionally compiling deprecated functions, only. While it becomes impossible to link against such a library in case one uses deprecated functions, distributors of libgit2 aren't expected to pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real" hard deprecation still makes sense in the context of CI to test we don't use deprecated symbols ourselves and in case a dependant uses libgit2 in a vendored way and knows it won't ever use any of the deprecated symbols anyway.
* tree-wide: mark local functions as staticPatrick Steinhardt2020-06-091-2/+2
| | | | | | | We've accumulated quite some functions which are never used outside of their respective code unit, but which are lacking the `static` keyword. Add it to reduce their linkage scope and allow the compiler to optimize better.
* strarray: we should `dispose` instead of `free`Edward Thomson2020-06-011-1/+1
| | | | | | We _dispose_ the contents of objects; we _free_ objects (and their contents). Update `git_strarray_free` to be `git_strarray_dispose`. `git_strarray_free` remains as a deprecated proxy function.
* Merge pull request #5336 from libgit2/ethomson/credtypePatrick Steinhardt2020-01-301-1/+1
|\ | | | | cred: change enum to git_credential_t and GIT_CREDENTIAL_*
| * credential: change git_cred to git_credentialethomson/credtypeEdward Thomson2020-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | remote functions: return an intEdward Thomson2020-01-241-2/+6
|/ | | | | Stop returning a void for functions, future-proofing them to allow them to fail.
* remote: remove unused block of codePatrick Steinhardt2019-08-021-29/+0
| | | | | | | | | | | In "remote.c", we have a chunk of code that is #ifdef'fed out via `#if 0` with a comment that we could export it as a helper function. The code was implemented in 2013 and ifdef'fed in 2014, which shows that there's clearly no interest in having such a helper at all. As this block has recently created some confusion about `p_getenv` due to it containing the only reference to that function in our codebase, let's remove this block altogether.
* Rename opt init functions to `options_init`Edward Thomson2019-06-141-1/+6
| | | | | | | | | | | | | 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.
* remote: add callback to resolve URLs before connectingErik Aigner2019-05-211-21/+43
| | | | | | 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.
* indexer: use git_indexer_progress throughoutEdward Thomson2019-02-221-1/+1
| | | | | Update internal usage of `git_transfer_progress` to `git_indexer_progreses`.
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-46/+46
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* references: use new names in internal usageethomson/git_refEdward Thomson2019-01-171-4/+4
| | | | Update internal usage to use the `git_reference` names for constants.
* remote: remove static create_internal functionEtienne Samson2018-11-021-10/+5
|
* remote: lower the default vector size to 8Etienne Samson2018-11-021-1/+1
| | | | As it is, this is space for 32 refs pointers, which feels a little much. Lower it to 8, as it is the minimum vector size anyway.