summaryrefslogtreecommitdiff
path: root/src/remote.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Pull extra_http_headers from the git_remoteMatt Burke2015-09-041-0/+2
|
* remote: don't confuse tag auto-follow rules with refspec matchingcmn/mirror-refspecCarlos Martín Nieto2015-08-111-4/+10
| | | | | | When we're looking to update a tag, we can't stop if the tag auto-follow rules don't say to update it. The tag might still match the refspec we were given.
* git__getenv: utf-8 aware env readerEdward Thomson2015-07-021-9/+18
| | | | | | Introduce `git__getenv` which is a UTF-8 aware `getenv` everywhere. Make `cl_getenv` use this to keep consistent memory handling around return values (free everywhere, as opposed to only some platforms).
* Merge pull request #3255 from libgit2/cmn/rename-unspecifiedEdward Thomson2015-06-251-2/+2
|\ | | | | Rename FALLBACK to UNSPECIFIED
| * Rename FALLBACK to UNSPECIFIEDcmn/rename-unspecifiedCarlos Martín Nieto2015-06-251-2/+2
| | | | | | | | | | Fallback describes the mechanism, while unspecified explains what the user is thinking.
* | remote: insert refspecs with no rhs in FETCH_HEADcmn/fetch-spec-fetchheadCarlos Martín Nieto2015-06-251-3/+14
|/ | | | | | | | | When a refspec contains no rhs and thus won't cause an explicit update, we skip all the logic, but that means that we don't update FETCH_HEAD with it, which is what the implicit rhs is. Add another bit of logic which puts those remote heads in the list of updates so we put them into FETCH_HEAD.
* remote: return EINVALIDSPEC when given an empty URLcmn/url-emptyCarlos Martín Nieto2015-06-161-2/+6
| | | | | | This is what we used to return in the settter and there's tests in bindings which ask for this. There's no particular reason to stop doing so.
* remote: some error-handling issues from CoverityCarlos Martín Nieto2015-06-071-2/+3
|