summaryrefslogtreecommitdiff
path: root/src/remote.c
Commit message (Collapse)AuthorAgeFilesLines
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-4/+4
|
* errors: Rename the generic return codesVicent Martí2012-05-181-5/+5
|
* global: Change parameter ordering in APIVicent Martí2012-05-181-2/+2
| | | | Consistency is good.
* fetch: filter tag annotation pseudo-refs while generating wantsCarlos Martín Nieto2012-05-091-4/+0
| | | | | | | 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.
* remote: don't try to create tag annotations as refs/tags/v0.1.0^{}Carlos Martín Nieto2012-05-091-0/+4
| | | | | Skip them for now. Eventually we might want to filter these out earler.
* remotes: change git_remote_new's signatureCarlos Martín Nieto2012-05-081-6/+13
| | | | | Add a fetch refspec arguemnt and make the arguments (name, url, refspec), as that order makes more sense.
* remote: add git_remote_add()Carlos Martín Nieto2012-05-081-0/+25
| | | | Helper function to create a remote with the default settings
* remote: make git_remote_load() return GIT_ENOTFOUND when the remote url ↵nulltoken2012-05-081-3/+1
| | | | cannot be retrieved from the config file
* remote: ensure the allocated remote is freed when an error occurs during its ↵nulltoken2012-05-081-8/+16
| | | | loading
* remote: don't free transport on disconnectMichael Schubert2012-05-021-8/+10
| | | | | | | | | | | | | | | | | | | | | | Currently, git_remote_disconnect not only closes the connection but also frees the underlying transport object, making it impossible to write code like // fetch stuff git_remote_download() // close connection git_remote_disconnect() // call user provided callback for each ref git_remote_update_tips(remote, callback) because remote->refs points to references owned by the transport object. This means, we have an idling connection while running the callback for each reference. Instead, allow immediate disconnect and free the transport later in git_remote_free().
* Merge pull request #642 from arrbee/mem-poolsRussell Belfer2012-04-251-1/+1
|\ | | | | Memory pools and khash hashtables
| * Implement git_pool paged memory allocatorRussell Belfer2012-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a `git_pool` object that can do simple paged memory allocation with free for the entire pool at once. Using this, you can replace many small allocations with large blocks that can then cheaply be doled out in small pieces. This is best used when you plan to free the small blocks all at once - for example, if they represent the parsed state from a file or data stream that are either all kept or all discarded. There are two real patterns of usage for `git_pools`: either for "string" allocation, where the item size is a single byte and you end up just packing the allocations in together, or for "fixed size" allocation where you are allocating a large object (e.g. a `git_oid`) and you generally just allocation single objects that can be tightly packed. Of course, you can use it for other things, but those two cases are the easiest.
* | remote: run a callback when updating the branch tipsCarlos Martín Nieto2012-04-251-3/+23
| | | | | | | | | | | | | | | | This allows the caller to update an internal structure or update the user output with the tips that were updated. While in the area, only try to update the ref if the value is different from its old one.
* | fetch: use the streaming indexer when downloading a packCarlos Martín Nieto2012-04-251-3/+3
|/ | | | | | | | This changes the git_remote_download() API, but the existing one is silly, so you don't get to complain. The new API allows to know how much data has been downloaded, how many objects we expect in total and how many we've processed.
* error-handling: remote, transportCarlos Martín Nieto2012-04-111-145/+101
|
* Clean up GIT_UNUSED macros on all platformsRussell Belfer2012-03-021-2/+2
| | | | | | | | | | | | | | | | | | | It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5 did not fix the GIT_USUSED behavior on all platforms. This commit walks through and really cleans things up more thoroughly, getting rid of the unnecessary stuff. To remove the use of some GIT_UNUSED, I ended up adding a couple of new iterators for hashtables that allow you to iterator just over keys or just over values. In making this change, I found a bug in the clar tests (where we were doing *count++ but meant to do (*count)++ to increment the value). I fixed that but then found the test failing because it was not really using an empty repo. So, I took some of the code that I wrote for iterator testing and moved it to clar_helpers.c, then made use of that to make it easier to open fixtures on a per test basis even within a single test file.
* Add git_remote_list()Carlos Martín Nieto2012-02-261-0/+69
| | | | | Loops through the configuration and generates a list of configured remotes.
* A remote exists with an URL aloneCarlos Martín Nieto2012-02-241-0/+3
| | | | | | | We used to consider it an error if a remote didn't have at least a fetch refspec. This was too much checking, as a remote doesn't in fact need to have anything other than an URL configured to be considered a remote.
* Fix check for writing remote's fetch and push configurationsCarlos Martín Nieto2012-02-211-2/+2
| | | | Fix copy-paste error
* Move git_remote_load() to git_bufCarlos Martín Nieto2012-02-201-22/+16
|
* Add git_remote_save()Carlos Martín Nieto2012-02-201-0/+50
|
* Add git_remote_set_{fetch,push}spec()Carlos Martín Nieto2012-02-201-0/+38
| | | | | Allow setting the fetch and push refspecs, which is useful for creating new refspecs.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* remote: don't try to free the ref on errorCarlos Martín Nieto2012-01-191-1/+2
| | | | On error, the pointer could be pointing anywhere.
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-8/+8
| | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* remote: Fix connected testVicent Marti2011-11-281-1/+1
|
* remote: Cleanup the remotes coderepo-ownershipVicent Marti2011-11-281-10/+25
| | | | | | - Hide the remaining transports code - Drop `git_headarray`, switch to using a callback to list refs. Makes the code cleaner.
* repository: Change ownership semanticsVicent Marti2011-11-261-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
* Free the created refs in git_remote_update_tipsCarlos Martín Nieto2011-11-221-0/+3
|
* Set transport to NULL after freeing itCarlos Martín Nieto2011-11-221-0/+1
|
* remote: Assert things that should be assertedVicent Marti2011-11-221-7/+23
|
* Add git_remote_connectedCarlos Martín Nieto2011-11-211-0/+5
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Add git_remote_disconnectCarlos Martín Nieto2011-11-211-6/+11
| | | | | | | It can be useful to separate disconnecting from actually destroying the object. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Add a name to a remote created from the APICarlos Martín Nieto2011-11-181-1/+13
| | | | | | Make it a bit more resilient. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* remote: get rid of git_remote_negotiateCarlos Martín Nieto2011-11-181-5/+5
| | | | | | | There is no good reason to expose the negotiation as a different step to downloading the packfile. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-10/+10
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* fetch: store FETCH_HEADCarlos Martín Nieto2011-10-081-2/+15
| | | | | | We should always save the remote's HEAD as FETCH_HEAD locally. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Merge pull request #384 from kiryl/warningsVicent Martí2011-09-181-5/+0
|\ | | | | Add more -W flags to CFLAGS
| * CMakefile: add -Wmissing-prototypes and fix warningsKirill A. Shutemov2011-08-301-5/+0
| | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | Merge pull request #399 from carlosmn/free-nullVicent Martí2011-09-181-0/+3
|\ \ | | | | | | Add checks for NULL to the config and remote free functions
| * | Add checks for NULL to the config and remote free functionsCarlos Martín Nieto2011-09-131-0/+3
| |/ | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Tabify everythingVicent Marti2011-09-191-1/+1
| | | | | | | | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* | Cleanup legal dataVicent Marti2011-09-191-21/+3
|/ | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* Add git_remote_newCarlos Martín Nieto2011-08-301-0/+20
| | | | | | | As we no longer expose the transport functions, this is now the only way to connect to a remote when given an URL instead of a remote name Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Don't hide the transport detailsCarlos Martín Nieto2011-08-301-5/+6
| | | | | | | Transports shouldn't get used outside of the library, so don't expose accessor functions. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Drop STRLEN() macrosKirill A. Shutemov2011-08-251-1/+1
| | | | | | | There is no need in STRLEN macros. Compilers can do this trivial optimization on its own. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* posix: Properly handle `snprintf` in all platformsVicent Marti2011-08-181-3/+3
|
* Add git_remote_update_tipsCarlos Martín Nieto2011-08-181-0/+27
| | | | | | | This function updates the references in the local reference storage to match the ones in the remote. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Only wait for pack if we need itCarlos Martín Nieto2011-08-181-0/+5
| | | | | | | Provide the git_remote_download function to instruct the library to downlad the packfile and let the user know the temporary location. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Don't expose the fetch code to the userCarlos Martín Nieto2011-08-181-0/+11
| | | | | | | | Move the generation of the want-list to be done from the negotiate function, and keep the filtered references inside the remote structure. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>