Commit Graph

1632 Commits

Author SHA1 Message Date
Sebastian Schuberth
353560b440 Get rid of a superfluous pointer cast 2011-09-08 17:08:10 +02:00
Sebastian Schuberth
45e93ef34e Fix minor indentation issues (spaces to tabs) 2011-09-08 17:07:52 +02:00
Sebastian Schuberth
26e74c6ace Fix some random size_t vs. int conversion warnings 2011-09-08 17:07:37 +02:00
Carlos Martín Nieto
76a9081db2 pkt: don't use strlen before we know the name is NUL-terminated
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-07 16:37:19 +02:00
Carlos Martín Nieto
db84b7988b Move extract_host_and_port to netops and add default port argument
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-04 16:07:52 +02:00
Carlos Martín Nieto
3d975abcb8 Add HTTP transport skeleton
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-04 16:04:14 +02:00
Vicent Martí
564f0f7be1 Merge pull request #388 from lambourg/master
pull request for #387
2011-09-02 06:08:47 -07:00
Jerome Lambourg
13bc2016b7 Fix for issue #387 2011-09-02 13:04:29 +02:00
Vicent Marti
c035ede234 Fix compilation in MinGW 2011-08-31 03:56:57 +02:00
Kirill A. Shutemov
d568d5856b CMakefile: add -Wmissing-prototypes and fix warnings
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-30 23:55:22 +03:00
Kirill A. Shutemov
51d0044629 CMakefile: add -Wstrict-prototypes and fix warnings
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-30 23:33:59 +03:00
Kirill A. Shutemov
0b2c406187 CMakefile: add -Wstrict-aliasing=2 and fix warnings
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-30 23:06:04 +03:00
Vicent Marti
2fcf9c8273 posix: Fix undeclared prototype 2011-08-30 11:32:33 -07:00
Vicent Marti
6f1d23b29f repository: Fix signed/unsigned comp. 2011-08-30 11:27:36 -07:00
Vicent Marti
92e34fa6d6 netops: This is the proper check 2011-08-30 19:48:13 +02:00
Vicent Martí
b298e03b16 Merge pull request #380 from kiryl/no-release-debug
CMakeLists: no need in split debug/release build
2011-08-30 10:46:40 -07:00
Vicent Marti
0bd594b61c netops: Use the size_t, Luke 2011-08-30 19:44:09 +02:00
Carlos Martín Nieto
778e1c739b 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>
2011-08-30 19:37:14 +02:00
Carlos Martín Nieto
b5a8aa94bf 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>
2011-08-30 19:37:14 +02:00
Carlos Martín Nieto
74bd343ae8 Fix Windows compilation
Sockets on Windows are unsigned, so define a type GIT_SOCKET which is
signed or unsigned depending on the platform.

Thanks to Em for his patience with this.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-30 19:37:14 +02:00
Vicent Marti
f978b748bb compat: Move mkstemp to the POSIX compat layer 2011-08-30 13:34:14 +02:00
Vicent Marti
3ef7d06302 network: <select.h> is not available in MinGW 2011-08-30 13:10:47 +02:00
Vicent Martí
aa2f68d807 Merge pull request #378 from kiryl/Wuninitialized
Wuninitialized
2011-08-30 03:39:28 -07:00
Vicent Martí
420cbdc24d Merge pull request #379 from kiryl/STRLEN
Drop STRLEN() macros
2011-08-25 20:42:03 -07:00
Kirill A. Shutemov
85b9165201 pkt: use sizeof() instead of strlen() to avoid variable length array
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-26 00:02:06 +03:00
Kirill A. Shutemov
932669b865 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>
2011-08-25 16:41:15 +03:00
Kirill A. Shutemov
0d5aa7d7b8 CMakeLists: no need in split debug/release build
With GNU toolchain there's no need to split debug/release build.

It's useful to have -O2 in debug envitonment since GCC show more
warnings in this case. -O2 -g works fine.

For release purpose, debug information can be stripted on later stage.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-25 14:31:19 +03:00
Kirill A. Shutemov
c75a890b60 transport_git: add missed error handling
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-24 20:11:15 +03:00
Kirill A. Shutemov
d7f0ababe1 Fix false positive -Wuninitialized warnings
GCC produces several -Wuninitialized warnings. Most of them can be fixed
if we make visible for gcc that git__throw() and git__rethrow() always
return first argument.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-24 20:10:50 +03:00
Vicent Marti
a7e34e3c85 transport: Merge bitfield
I don't think MSVC merges these automatically.
2011-08-18 02:35:28 +02:00
Vicent Marti
84dd3820d4 posix: Properly handle snprintf in all platforms 2011-08-18 02:35:28 +02:00
Vicent Marti
c85e08b1bd odb: Do not pass around a header when hashing 2011-08-18 02:34:10 +02:00
Carlos Martín Nieto
7adba5f49c Keep sending want lines if the server doesn't anwer a flush
Some servers take a long time to answer and expect us to keep sending
want lines; otherwise they close the connection. Avoid this by waiting
for one second for the server to answer. If the timeout runs out,
treat is as a NAK and keep sending want lines.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:10 +02:00
Carlos Martín Nieto
427ca3d3c5 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>
2011-08-18 02:34:10 +02:00
Carlos Martín Nieto
946dab73ba Implement and bind local_send_wants
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:10 +02:00
Carlos Martín Nieto
22f65b9e73 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>
2011-08-18 02:34:10 +02:00
Carlos Martín Nieto
79e9c3eca2 Update transport lifetime documentation
The original was written before any code was written and had nothing
to do with the way things are actually done.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:09 +02:00
Carlos Martín Nieto
cdfd7bd057 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>
2011-08-18 02:34:09 +02:00
Carlos Martín Nieto
a1be77cd35 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>
2011-08-18 02:34:09 +02:00
Carlos Martín Nieto
1564db11fe Remove enum git_whn
Instead, use flags inside the git_remote_head structure.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:09 +02:00
Carlos Martín Nieto
ade3c9bb88 Assert a filename in indexer creation
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:09 +02:00
Carlos Martín Nieto
7284c1059f Don't try to download the packfile too early
Make sure we only try to download the pack if we find the pack header
in the stream, and not if the server takes a bit longer to send us the
last NAK.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
441f57c2b7 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>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
c1af5a3935 Implement cooperative caching
When indexing a file with ref deltas, a temporary cache for the
offsets has to be built, as we don't have an index file yet. If the
user takes the responsiblity for filling the cache, the packing code
will look there first when it finds a ref delta.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
061047ccb6 Rethrow pack entry offset error
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
2f512ff81e Use strcpy+strcat as memcpy was overlapping
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
0437d991bf Use common capabilities
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
48a65a071d 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>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
9cf0f287bb Tell the user where the downloaded packfile is stored
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
e1d8803068 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>
2011-08-18 02:34:08 +02:00