src/pkt.c


Log

Author Commit Date CI Message
Carlos Martín Nieto 84d250bf 2012-03-06T10:23:02 error-handling: protocol, pkt
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.
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
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 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 3707b331 2011-10-08T02:44:31 pkt: move the protocol strings to the top of the file Put them all together so we know where to find them. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 51760bc1 2011-10-05T18:11:22 pkt: get rid of the chunked support It was a bad idea. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto e5e92c1f 2011-10-05T16:57:34 http: simple negotiation Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 65c86048 2011-10-05T01:28:16 Introduce the git_pkt_buffer_ family of functions Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 34bfb4b0 2011-09-14T00:54:45 net,pkt: add chunked support As we don't know the length of the message we want to send to the other end, we send a chunk size before each message. In later versions, sending the wants might benefit from batching the lines together. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 922bc225 2011-10-01T14:34:51 pkt: send all of the wants in the negotiation A missing if caused the function to return after the first want line without capabilities. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Martí 01ab592b 2011-09-22T10:28:05 Merge pull request #421 from nulltoken/ntk/fix/config-get-set-long config: make git_config_[get|set]_long() able to properly deal with 8 bytes wide values
Vicent Martí 8114ee4c 2011-09-22T10:17:43 Merge pull request #405 from carlosmn/http-ls Implement ls-remote over HTTP
nulltoken ad196c6a 2011-09-21T23:17:39 config: make git_config_[get|set]_long() able to properly deal with 8 bytes wide values Should fix issue #419. Signed-off-by: nulltoken <emeric.fermas@gmail.com>
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 b76f7522 2011-09-04T21:28:11 pkt: add the comment type This is needed for smart HTTP Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 76a9081d 2011-09-07T16:35:11 pkt: don't use strlen before we know the name is NUL-terminated Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Kirill A. Shutemov 85b91652 2011-08-25T23:57:06 pkt: use sizeof() instead of strlen() to avoid variable length array Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
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 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 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 0437d991 2011-08-05T15:45:05 Use common capabilities 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 65fbc48a 2011-06-24T16:23:19 negotiation
Carlos Martín Nieto 0132cf64 2011-06-25T00:23:48 git_pkt_send_wants
Vicent Marti bdd18829 2011-07-11T02:58:00 Cleanup external API Some of the WIP API calls have been hidden in preparation for the next minor release.
Carlos Martín Nieto c7c787ce 2011-06-24T18:19:00 Use gitno_buffer in the git transport This allows us to leave out the buffer handling logic. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto fd679021 2011-06-16T02:17:49 Move git_pkt_{gen_proto,send_request} to transport_git.c This is where they really belong. Remvoe the prefix and make them static. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto cbf742ac 2011-06-26T19:40:02 Use (s)size_t Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto c4d0fa85 2011-06-16T01:54:19 Implement and use git_pkt_send_request This makes it easier to send a requqest for an URL. It assumes there is a socket where the string should go out to. Make git_pkt_gen_proto accept a command parameter, which defaults to git-upload-pack Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 7632e249 2011-06-13T23:01:12 Correctly handle network input Add a parameter to git_pkt_parse_line to tell it how much data you have in your buffer. If the buffer is too short, it returns an error saying so. Adapt the git transport to use this and fix the offset calculation. Add the GIT_ESHORTBUFFER error code.
Carlos Martín Nieto be9fe679 2011-06-08T23:38:22 Implement and use git_pkt_free A git_pkt object can be one of several structs. Add this function for convenience and clarity. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 6a9597c5 2011-06-08T19:11:38 Add function to generate a request Add git_pkt_gen_proto to crete a request from an url. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 8b9e8de5 2011-06-08T10:51:32 pkt-line: read capabilities Try to read the server capabilities and add them to the git_pkt_ref struct. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto b31803f3 2011-05-28T11:59:10 pkt-line: parse other-ref lines Add support for parsing other-ref lines. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 78fae478 2011-06-06T14:19:47 pkt: make sure we really only read the length A pkt-line's length are described in its first four bytes in ASCII hex. Copy this substring to another string before feeding it to git__strtol32. Otherwise, it will read the whole hash. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 1d27446c 2011-05-28T10:56:19 Move flush-pkt creation into its own function Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto f7fc68df 2011-05-27T12:50:07 Lay the foundations for pkt-line parsing This are the types I intend to use for pkt-line parsing and (later) creation. git_pkt serves as a base pointer type and once you know what type it is you can use the real one (command, tip list, etc.) Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>