Commit Graph

1510 Commits

Author SHA1 Message Date
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
Carlos Martín Nieto
44daec4229 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>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
da2902204b Download pack
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
7e1a94db11 Move have sending
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
b4c9063040 Implement sending haves
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
0e20ba6066 Add a generic send_wants
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
65fbc48a17 negotiation 2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
0132cf6438 git_pkt_send_wants 2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
e1f4a76150 Add git_fetch_list_want which creates the "want" list
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:07 +02:00
Vicent Martí
c94bc192e3 Merge pull request #375 from schu/cleanup
cleanup: some nitpicking and missing free's.
2011-08-17 17:33:44 -07:00
schu
d4958b8848 refs.c: remove two lines of dead code
Signed-off-by: schu <schu-github@schulog.org>
2011-08-17 16:37:59 +02:00
schu
e7a3b3171b reflog.c: fix memory leaks
Signed-off-by: schu <schu-github@schulog.org>
2011-08-17 16:37:53 +02:00
schu
31e5909214 git__strndup: immediately return NULL when ENOMEM
Signed-off-by: schu <schu-github@schulog.org>
2011-08-17 15:24:48 +02:00
schu
5a0659fe3b config_file.c: fix memory leaks
Signed-off-by: schu <schu-github@schulog.org>
2011-08-17 14:36:53 +02:00
schu
b6817692a6 tsort.c: fix include of common.h
Signed-off-by: schu <schu-github@schulog.org>
2011-08-17 12:14:47 +02:00
schu
7fade6c63a unix/posix.h: remove redundant include
Signed-off-by: schu <schu-github@schulog.org>
2011-08-17 12:14:12 +02:00
Vicent Martí
ec5b158996 Merge pull request #373 from carlosmn/fancy-branchname
Fix the reference character check for Unicode
2011-08-16 10:13:45 -07:00
Carlos Martín Nieto
50a8fd0367 Fix the reference character check for Unicode
We need to do an unsigned comparison, as otherwise UTF-8 characters
might look like they have the sign bit set and the check will fail.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-08-16 18:16:44 +02:00
Vicent Martí
3a97bff3dc Merge pull request #372 from schu/reflog-return-oid
reflog: assimilate API
2011-08-16 01:37:15 -07:00
schu
bcb080b00a reflog: fix memory leaks
Make sure to free the existing reflog when we run out or memory while
adding new entries.

Signed-off-by: schu <schu-github@schulog.org>
2011-08-16 10:17:26 +02:00
schu
e7be57a98b reflog: assimilate reflog API to return git_oid's
Rather than returning the OIDs out of the reflog as string return them
as git_oid.

Signed-off-by: schu <schu-github@schulog.org>
2011-08-15 21:14:51 +02:00
Vicent Martí
bae88c0dc6 Merge pull request #366 from belkiss/development
Add missing GIT_BEGIN_DECL and GIT_END_DECL to indexer header
2011-08-13 09:58:11 -07:00
Lambert CLARA
a6bbb8cab6 Add missing GIT_BEGIN_DECL and GIT_END_DECL to indexer header 2011-08-13 10:56:33 +02:00