Commit Graph

9 Commits

Author SHA1 Message Date
Carlos Martín Nieto
cbf742ac4e Use (s)size_t
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 20:43:44 +02:00
Carlos Martín Nieto
c4d0fa85b1 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>
2011-06-26 20:43:44 +02:00
Carlos Martín Nieto
7632e2494a 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.
2011-06-26 20:43:44 +02:00
Carlos Martín Nieto
be9fe679fc 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>
2011-06-26 18:18:13 +02:00
Carlos Martín Nieto
ecb6ca0e1f Implement the git TCP transport up to ls-remote
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:13 +02:00
Carlos Martín Nieto
6a9597c5b5 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>
2011-06-26 18:18:12 +02:00
Carlos Martín Nieto
8b9e8de5ce 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>
2011-06-26 18:18:12 +02:00
Carlos Martín Nieto
b31803f310 pkt-line: parse other-ref lines
Add support for parsing other-ref lines.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:12 +02:00
Carlos Martín Nieto
f7fc68df83 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>
2011-06-26 18:18:12 +02:00