summaryrefslogtreecommitdiff
path: root/src/fetch.c
Commit message (Collapse)AuthorAgeFilesLines
* refs: introduce git_reference_name_is_validEdward Thomson2020-10-251-2/+5
| | | | | | | | Provide a function that can check reference 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 reference's name.
* 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.
* 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.
* 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-1/+1
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* refspec: rename `git_refspec__free` to `git_refspec__dispose`Patrick Steinhardt2018-06-291-2/+2
| | | | | | | | | 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.
* 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.
* giterr_set: consistent error messagesEdward Thomson2016-12-291-1/+1
| | | | | | | | 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
* Rename FALLBACK to UNSPECIFIEDcmn/rename-unspecifiedCarlos Martín Nieto2015-06-251-1/+1
| | | | | Fallback describes the mechanism, while unspecified explains what the user is thinking.
* remote: move the tagopt setting to the fetch optionsCarlos Martín Nieto2015-05-131-7/+11
| | | | | This is another option which we should not be keeping in the remote, but is specific to each particular operation.
* Remove the callbacks struct from the remoteCarlos Martín Nieto2015-05-131-3/+16
| | | | | | | | | | | | | | 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.
* Changed GIT_REMOTE_DOWNLOAD_TAGS_ALL to behave like git 1.9.0Pierre-Olivier Latour2014-11-091-6/+6
|
* Don't reset need_packEtienne Samson2014-03-301-1/+2
| | | While looping over multiple heads, an up-to-date head will clobber the `remote->need_pack` setting, preventing the rest of the machinery from building and downloading a pack-file, breaking fetches.
* - need_pack was not set to 0 when local fetch was already present causing ↵Miha2014-02-251-1/+3
| | | | negotiate_fetch access violation
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* remote: fix a couple of leaksCarlos Martín Nieto2013-11-111-1/+4
|
* remote: make _ls return the list directlyCarlos Martín Nieto2013-11-111-23/+20
| | | | | | | | | | | The callback-based method of listing remote references dates back to the beginning of the network code's lifetime, when we didn't know any better. We need to keep the list around for update_tips() after disconnect() so let's make use of this to simply give the user a pointer to the array so they can write straightforward code instead of having to go through a callback.
* remote: store dwimed refspecs separatelyCarlos Martín Nieto2013-11-011-9/+13
| | | | | This allows us to add e.g. "HEAD" as a refspec when none are given without overwriting the user's data.
* remote: download HEAD when no refspecs are givenCarlos Martín Nieto2013-11-011-5/+6
| | | | | | | The correct behaviour when a remote has no refspecs (e.g. a URL from the command-line) is to download the remote's HEAD. Let's do that. This fixes #1261.
* remote: put the _download() callback with the othersCarlos Martín Nieto2013-10-021-5/+3
| | | | | | The text progress and update_tips callbacks are already part of the struct, which was meant to unify the callback setup, but the download one was left out.
* Reorganize diff and add basic diff driverRussell Belfer2013-06-101-0/+2
| | | | | | | | | | | | | | | | | | This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
* remote: correctly interpret tagopt '--tags'Carlos Martín Nieto2013-05-071-3/+9
| | | | | | | When tagopt is set to '--tags', we should only take the default tags refspec into account and ignore any configured ones. Bring the code into compliance.
* remote: handle multiple refspecsCarlos Martín Nieto2013-04-201-2/+1
| | | | | | | | | | | | | A remote can have a multitude of refspecs. Up to now our git_remote's have supported a single one for each fetch and push out of simplicity to get something working. Let the remotes and internal code know about multiple remotes and get the tests passing with them. Instead of setting a refspec, the external users can clear all and add refspecs. This should be enough for most uses, though we're still missing a querying function.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* create callback to handle packs from fetch, move the indexer to odb_packEdward Thomson2012-11-051-1/+0
|
* Reorganize transport architecture (squashed 3)Philip Kelley2012-11-011-382/+11
|
* Remove 'bytes' param from git_remote_downloadBen Straub2012-10-241-10/+4
|
* Network progress: rename thingsBen Straub2012-10-241-10/+10
| | | | | | | git_indexer_stats and friends -> git_transfer_progress* Also made git_transfer_progress members more sanely named.
* gitno_buffer: callback on each packetBen Straub2012-10-191-0/+33
| | | | | The fetch code takes advantage of this to implement a progress callback every 100kb of transfer.
* Fetch/indexer: progress callbacksBen Straub2012-10-191-4/+11
|
* Add git_indexer_stats field to git_remoteBen Straub2012-10-191-3/+3
| | | | | Also removing all the *stats parameters from external APIs that don't need them anymore.
* fetch: declare variables at the top of the blockCarlos Martín Nieto2012-10-181-1/+2
|
* remote: support fetch cancelationCarlos Martín Nieto2012-10-181-5/+28
| | | | | | Introduce git_remote_stop() which sets a variable that is checked by the fetch process in a few key places. If this is variable is set, the fetch is aborted.
* test: fix some memory leaksnulltoken2012-10-151-3/+9
|
* remote: support downloading all tagsCarlos Martín Nieto2012-09-301-10/+17
| | | | Also honor remote.$name.tagopt = --tags.
* Diff iteratorsRussell Belfer2012-09-051-1/+1
| | | | | | | | | | | This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
* indexer: kill git_indexer_stats.data_receivedCarlos Martín Nieto2012-08-261-10/+4
| | | | | | | It's not really needed with the current code as we have EOS and the sideband's flush to tell us we're done. Keep the distinction between processed and received objects.
* network: add sideband supportCarlos Martín Nieto2012-08-241-8/+58
| | | | | This lets us notify the user of what the remote end is doing while we wait for it to start sending us the packfile.
* indexer: recognize and mark when all of the packfile has been downloadedCarlos Martín Nieto2012-08-241-1/+4
| | | | | We can't always rely on the network telling us when the download is finished. Recognize it from the indexer itself.
* remote: add missing include git2/remote.hMichael Schubert2012-08-041-1/+0
| | | | | Otherwise we get an incomplete type error, since git_remote_callbacks isn't declared yet.
* fetch: remove timeout codeCarlos Martín Nieto2012-07-301-13/+0
|
* transport: store the refs in a common areaCarlos Martín Nieto2012-07-301-1/+1
| | | | | | | | Instad of each transport having its own function and logic to get to its refs, store them directly in transport. Leverage the new gitno_buffer to make the parsing and storing of the refs use common code and get rid of the git_protocol struct.
* remote: use the same code to control git and httpCarlos Martín Nieto2012-07-301-26/+60
| | | | | | | | This allows us to add capabilitites to both at the same time, keeps them in sync and removes a lot of code. gitno_buffer now uses a callback to fill its buffer, allowing us to use the same interface for git and http (which uses callbacks).
* network: implement multi_ack for the git transportCarlos Martín Nieto2012-07-301-20/+58
|
* remote: start moving the protocol to a common areaCarlos Martín Nieto2012-07-301-6/+123
| | | | | | | For the transition, http is going to keep its own logic until the git/common code catches up with the implied multi_ack that http has. This also has the side-effect of making the code cleaner and more correct regardingt he protocol.
* indexer: don't use '/objects/pack/' unconditionallyCarlos Martín Nieto2012-06-281-2/+7
| | | | | Not everyone who indexes a packfile wants to put it in the standard git repository location.
* http: add https support when GnuTLS is availableCarlos Martín Nieto2012-05-191-2/+2
| | | | | | | | If it's not available, an error saying so will be returned when trying to use a https:// URL. This also unifies a lot of the network code to use git_transport in many places instead of an socket descriptor.
* refs: git_reference_listall -> git_reference_listVicent Martí2012-05-181-1/+1
|
* fetch: filter tag annotation pseudo-refs while generating wantsCarlos Martín Nieto2012-05-091-0/+4
| | | | | | | These objects aren't considered as being advertised, so asking for them will cause the remote end to close the connection. This makes the checking in update_tips() unnecessary, because they don't get inserted in the list.
* Remove old and unused error codesVicent Martí2012-05-021-9/+1
|