src/fetch.c


Log

Author Commit Date CI Message
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 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.
Russell Belfer b762e576 2011-11-17T15:10:27 filebuf: add GIT_FILEBUF_INIT and protect multiple opens and cleanups Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT and make git_filebuf_open and git_filebuf_cleanup safe to be called multiple times on the same buffer. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Brodie Rao 01ad7b3a 2011-09-06T15:48:45 *: correct and codify various file permissions The following files now have 0444 permissions: - loose objects - pack indexes - pack files - packs downloaded by fetch - packs downloaded by the HTTP transport And the following files now have 0666 permissions: - config files - repository indexes - reflogs - refs This brings libgit2 more in line with Git. Note that git_filebuf_commit() and git_filebuf_commit_at() have both gained a new mode parameter. The latter change fixes an important issue where filebufs created with GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3) usage). Now we chmod() the file before renaming it into place. Tests have been added to confirm that new commit, tag, and tree objects are created with the right permissions. I don't have access to Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
Carlos Martín Nieto 2c982daa 2011-10-05T20:09:49 fetch: add a generic pack-download function Taken mostly from the git transport's version, this can be used by any transport that takes its pack data from the network. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 1636ba5a 2011-09-18T20:07:49 transport: don't have an extra send-wants step It's a bit awkward to run it as an extra step, and HTTP may need to send the wants list several times. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 8f9be316 2011-10-09T21:49:10 fetch: move 'head' so it's visible to the whole function Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
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>
Carlos Martín Nieto 4a3b18a6 2011-10-03T22:26:06 A missing refspec is not an error It's rare for a configured remote, but for one given as an URL on the command line, it's more often than not the case. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
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 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>
Carlos Martín Nieto 427ca3d3 2011-08-12T22:44:35 Actually implement object negotiation Only signal that we need a pack if we do need it and don't send a want just because it's the first. If we don't need to download the pack, then we can skip all of the negotiation and just return success. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 22f65b9e 2011-08-10T20:49:43 Move negotiation to the transport There are many ways how a transport might negotiate with the server, so instead of making it fit into the smart protocol model, let the transport do its thing. For now, the git protocol limits itself to send only 160 "have" lines so we don't flood the server. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto cdfd7bd0 2011-08-10T14:46:18 Use time sorting in fetch This is what the docs say tha we should use. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto a1be77cd 2011-08-07T14:27:47 Be smarter about selecting wants There is no need to inspect what the local repository is like. Only check whether the objects exist locally. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 1564db11 2011-08-07T14:02:04 Remove enum git_whn Instead, use flags inside the git_remote_head structure. 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 9cf0f287 2011-08-04T17:50:50 Tell the user where the downloaded packfile is stored 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 da290220 2011-07-31T02:40:43 Download pack Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 7e1a94db 2011-07-31T01:16:47 Move have sending 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 65fbc48a 2011-06-24T16:23:19 negotiation
Carlos Martín Nieto e1f4a761 2011-06-22T14:53:01 Add git_fetch_list_want which creates the "want" list Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>