src/remote.c


Log

Author Commit Date CI Message
Carlos Martín Nieto 11678b37 2012-05-09T16:18:13 fetch: filter tag annotation pseudo-refs while generating wants 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.
Carlos Martín Nieto 0536afca 2012-05-09T14:10:30 remote: don't try to create tag annotations as refs/tags/v0.1.0^{} Skip them for now. Eventually we might want to filter these out earler.
Carlos Martín Nieto a209a025 2012-05-03T16:08:33 remote: add git_remote_add() Helper function to create a remote with the default settings
Carlos Martín Nieto baaa8a44 2012-05-03T20:25:56 remotes: change git_remote_new's signature Add a fetch refspec arguemnt and make the arguments (name, url, refspec), as that order makes more sense.
nulltoken 9fb70f37 2012-05-07T10:57:34 remote: make git_remote_load() return GIT_ENOTFOUND when the remote url cannot be retrieved from the config file
nulltoken 2fb9d6de 2012-05-07T10:04:50 remote: ensure the allocated remote is freed when an error occurs during its loading
Michael Schubert 42ea35c0 2012-05-01T22:25:43 remote: don't free transport on disconnect 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().
Russell Belfer 3fc5c65d 2012-04-25T15:24:05 Merge pull request #642 from arrbee/mem-pools Memory pools and khash hashtables
Russell Belfer 2bc8fa02 2012-04-17T10:14:24 Implement git_pool paged memory allocator 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.
Carlos Martín Nieto f184836b 2012-04-25T12:13:20 remote: run a callback when updating the branch tips 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.
Carlos Martín Nieto 7a520f5d 2012-04-13T23:19:38 fetch: use the streaming indexer when downloading a pack 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.
Carlos Martín Nieto 4376f7f6 2012-03-06T08:12:35 error-handling: remote, transport
Russell Belfer 854eccbb 2012-02-29T12:04:59 Clean up GIT_UNUSED macros on all platforms 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.
Carlos Martín Nieto 8171998f 2012-02-26T19:15:36 Add git_remote_list() Loops through the configuration and generates a list of configured remotes.
Carlos Martín Nieto 9554cd51 2012-02-24T12:14:26 A remote exists with an URL alone 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.
Carlos Martín Nieto 9c94a356 2012-02-21T12:15:23 Fix check for writing remote's fetch and push configurations Fix copy-paste error
Carlos Martín Nieto f0f3a18a 2012-02-20T19:42:27 Move git_remote_load() to git_buf
Carlos Martín Nieto 89e5ed98 2012-02-20T19:04:45 Add git_remote_save()
Carlos Martín Nieto bcb8c007 2012-02-20T18:37:07 Add git_remote_set_{fetch,push}spec() Allow setting the fetch and push refspecs, which is useful for creating new refspecs.
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
Carlos Martín Nieto 585a2eb7 2012-01-19T17:05:16 remote: don't try to free the ref on error On error, the pointer could be pointing anywhere.
Russell Belfer 97769280 2011-11-30T11:27:15 Use git_buf for path storage instead of stack-based buffers 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.
Vicent Marti b2337143 2011-11-28T18:46:25 remote: Fix connected test
Vicent Marti d88d4311 2011-11-28T08:40:40 remote: Cleanup the remotes code - Hide the remaining transports code - Drop `git_headarray`, switch to using a callback to list refs. Makes the code cleaner.
Vicent Marti 9462c471 2011-11-25T08:16:26 repository: Change ownership semantics 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.
Carlos Martín Nieto 39157563 2011-11-22T11:16:44 Free the created refs in git_remote_update_tips
Carlos Martín Nieto a3147114 2011-11-22T10:30:30 Set transport to NULL after freeing it
Vicent Marti 4bef3565 2011-11-22T02:16:20 remote: Assert things that should be asserted
Carlos Martín Nieto 6ac3b707 2011-11-21T20:48:59 Add git_remote_connected Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 4cf01e9a 2011-11-21T20:44:03 Add git_remote_disconnect It can be useful to separate disconnecting from actually destroying the object. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 617bfdf4 2011-11-18T21:28:07 Add a name to a remote created from the API Make it a bit more resilient. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 95057b85 2011-11-18T21:18:39 remote: get rid of git_remote_negotiate 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>
Vicent Marti 3286c408 2011-10-28T14:51:13 global: Properly use `git__` memory wrappers Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
Carlos Martín Nieto 517bda19 2011-10-04T00:30:01 fetch: store FETCH_HEAD We should always save the remote's HEAD as FETCH_HEAD locally. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Martí 71a4c1f1 2011-09-18T20:07:59 Merge pull request #384 from kiryl/warnings Add more -W flags to CFLAGS
Vicent Martí b3c524d1 2011-09-18T19:46:12 Merge pull request #399 from carlosmn/free-null Add checks for NULL to the config and remote free functions
Vicent Marti 87d9869f 2011-09-19T03:34:49 Tabify everything 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.
Vicent Marti bb742ede 2011-09-19T01:54:32 Cleanup legal data 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.
Carlos Martín Nieto 2aae2188 2011-09-13T02:05:12 Add checks for NULL to the config and remote free functions Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Kirill A. Shutemov d568d585 2011-08-30T23:55:22 CMakefile: add -Wmissing-prototypes and fix warnings Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Carlos Martín Nieto 778e1c73 2011-08-22T15:43:57 Add git_remote_new 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>
Carlos Martín Nieto b5a8aa94 2011-08-22T15:18:19 Don't hide the transport details 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>
Kirill A. Shutemov 932669b8 2011-08-25T14:22:57 Drop STRLEN() macros 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>
Vicent Marti 84dd3820 2011-08-18T02:13:51 posix: Properly handle `snprintf` in all platforms
Carlos Martín Nieto 441f57c2 2011-08-06T13:48:52 Add git_remote_update_tips 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>
Carlos Martín Nieto 48a65a07 2011-08-04T22:42:58 Only wait for pack if we need it 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>
Carlos Martín Nieto e1d88030 2011-08-04T13:07:55 Don't expose the fetch code to the user 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>
Carlos Martín Nieto 44daec42 2011-08-03T22:03:57 Bind the configuration and remotes to a repository Configurations when taken from a repository and remotes should be identifiable as coming from a particular repository. This allows us to reduce the amount of variables that the user has to keep track of. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto b4c90630 2011-07-30T22:29:00 Implement sending haves Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 0e20ba60 2011-07-30T18:56:20 Add a generic send_wants Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 0ac2726f 2011-06-27T20:23:47 Slim down git_transport Remove the unused repo and private pointers and make the direction a flag, as it can only have two states. Change the connect signature to use an int instead of git_net_direction and remove that enum. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 9ba49bb5 2011-06-23T03:04:23 Add git_remote_connect and git_remote_ls These allow you to implement git-ls-remote when given a reference name and a repository. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 2dc31040 2011-06-20T18:58:57 Abstract the refspec query and parse Move them to their own functions to avoid duplication and to make it easier to ignore missing configuration. Not finding 'fetch' is considered fatal, though this might not be correct behaviour (push-only remotes?) Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 9c82357b 2011-06-17T18:13:14 Add a remotes API Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>