summaryrefslogtreecommitdiff
path: root/src/remote.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* remote: add a flag to prevent generation of the default fetchspecEtienne Samson2018-11-021-4/+17
|
* remote: add a creation flag for ignoring url.insteadOfEtienne Samson2018-11-021-1/+1
|
* remote: provide a generic API for creating remotesEtienne Samson2018-11-021-39/+74
| | | | This supersedes the functionality of remote_create_with_fetchspec, remote_create_anonymous and remote_create_detached.
* remote: merge if-statementsEtienne Samson2018-11-021-5/+4
| | | | We need a repo/config and a name to be able to do anything to the configuration. As such, those two tests can be merged so their conditions are shared.
* remote: add a helper for generating the default fetchspecEtienne Samson2018-11-021-5/+11
|
* remote: move static methodEtienne Samson2018-11-021-23/+20
|
* Merge pull request #4794 from marcin-krystianc/mkrystianc/prune_perfPatrick Steinhardt2018-09-211-1/+1
|\ | | | | git_remote_prune to be O(n * logn)
| * git_remote_prune to be O(n * logn)Marcin Krystianc2018-09-021-1/+1
| |
* | remote: store the connection data in a private structEtienne Samson2018-09-071-15/+23
|/ | | | | | | | This makes it easier to pass connection-related options around (proxy & custom headers for now). This fixes a bug in git_push_finish, which didn't reuse the provided proxy if the connection closed between the call to `git_remote_push` and the finish step.
* remote: set the error before cleanupEtienne Samson2018-08-211-2/+2
| | | Otherwise we'll return stack data to the caller.
* refspec: rename `git_refspec__free` to `git_refspec__dispose`Patrick Steinhardt2018-06-291-7/+7
| | | | | | | | | Since commit 630a67366 (refspec: add public parsing api, 2018-02-07), we now have two functions `git_refspec_free` and `git_refspec__free`. The difference is that the first one will free the structure itself, while the second one will only free the structure's contents. Use our new `dispose` naming pattern for the latter function to help avoid confusion.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-33/+33
|
* remote: repo is optional hereEtienne Samson2018-04-201-1/+1
| | | As per CID:1378747, we might be called with a NULL repo, which would be deferenced in write_add_refspec
* remote: append to FETCH_HEAD rather than overwrite for each refspecCarlos Martín Nieto2017-12-261-0/+17
| | | | | | | | We treat each refspec on its own, but the code currently overwrites the contents of FETCH_HEAD so we end up with the entries for the last refspec we processed. Instead, truncate it before performing the updates and append to it when updating the references.
* Merge pull request #4288 from pks-t/pks/include-fixupsEdward Thomson2017-08-151-2/+2
|\ | | | | Include fixups
| * Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* | remote: add function to create detached remotesEric Myhre2017-05-051-7/+17
| | | | | | | | | | | | | | | | Right now it is only possible to create remotes from a repository. While this is probably the most common use-case, there are commands which make sense even without a repository, e.g. the equivalence of `git ls-remote`. Add a new function `git_remote_create_detached`, which simply accepts a URL.
* | remote: reject various actions for detached remotesPatrick Steinhardt2017-05-051-0/+17
| | | | | | | | | | | | | | There are only few actions which actually make sense for a detached remote, like e.g. `git_remote_ls`, `git_remote_prune`. For all the other actions, we have to report an error when the remote has no repository attached to it. This commit does so and implements some tests.
* | remote: improve error message if no URL is setPatrick Steinhardt2017-05-051-1/+3
|/ | | | | | | The current error message when connecting to a remote when no URL is set is missing information on whether it is missing a fetch or push URL. Furthermore, it results in undefined behavior when using a remote without name. Fix both issues.
* remote: free the config snapshotEdward Thomson2017-05-011-8/+8
| | | | This reverts commit 5552237 and frees the snapshot properly.
* Merge branch 'pr/4225'Edward Thomson2017-05-011-1/+1
|\
| * Allow NULL refspec in git_remote_pushYichao Yu2017-04-291-1/+1
| | | | | | | | Since this is allowed in `git_remote_upload`
* | Do not free config when creating remoteYichao Yu2017-04-291-1/+0
|/ | | | The regression was introduced in 22261344de18b3cc60ee6937468d66a6a6a28875
* Fixing a code style issueChristopher Bargren2017-02-101-3/+2
|
* Addressing PR feedback Christopher Bargren2017-02-081-12/+5
|
* Add support for lowercase proxy environment variablesChristopher Bargren2017-02-081-0/+12
| | | curl supports HTTPS_PROXY in addition to https_proxy (and their http counterparts). This change ensures parity with curl's behavior.
* giterr_set: consistent error messagesEdward Thomson2016-12-291-3/+3
| | | | | | | | Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
* remote: Handle missing config values when deleting a remoteDavid Turner2016-07-151-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Somehow I ended up with the following in my ~/.gitconfig: [branch "master"] remote = origin merge = master rebase = true I assume something went crazy while I was running the git.git tests some time ago, and that I never noticed until now. This is not a good configuration, but it shouldn't cause problems. But it does. Specifically, if you have this in your config, and you perform the following set of actions: create a remote fetch from that remote create a branch off of the remote master branch called "master" delete the branch delete the remote The remote delete fails with the message "Could not find key 'branch.master.rebase' to delete". This is because it's iterating over the config entries (including the ones in the global config) and believes that there is a master branch which must therefore have these config keys. https://github.com/libgit2/libgit2/issues/3856
* Remove unused static functionsPatrick Steinhardt2016-06-211-75/+0
|
* fetch: Fixed spurious update callback for existing tags.Jason Haslam2016-06-141-1/+5
|
* proxy: ask the user for credentials if necessaryCarlos Martín Nieto2016-04-191-6/+20
|
* remote: set error code in `create_internal`Patrick Steinhardt2016-02-231-2/+2
| | | | | | Set the error code when an error occurs in any of the called functions. This ensures we pass the error up to callers and actually free the remote when an error occurs.
* Copy custom_headers insteach of referencing the caller's copyMatt Burke2015-09-251-1/+1
|
* These can be staticMatt Burke2015-09-241-1/+1
|
* Avoid segfault when opts == NULLMatt Burke2015-09-101-3/+8
|
* Accept custom headers for fetch tooMatt Burke2015-09-101-2/+6
|
* Tell the git_transport about the custom_headersMatt Burke2015-09-081-5/+16
|
* Drop extra_http_headers from git_remoteMatt Burke2015-09-081-12/+0
|
* Allow the world to set HTTP headers for remotesMatt Burke2015-09-041-1/+11
|