Commit Graph

83 Commits

Author SHA1 Message Date
Linquize
7026ad893b calloc() to initialize memory 2013-05-16 21:11:38 +08:00
Russell Belfer
b7f167da29 Make git_oid_cmp public and add git_oid__cmp 2013-04-29 13:52:12 -07:00
Russell Belfer
5d2d21e536 Consolidate packfile allocation further
Rename git_packfile_check to git_packfile_alloc since it is now
being used more in that capacity.  Fix the various places that use
it.  Consolidate some repeated code in odb_pack.c related to the
allocation of a new pack_backend.
2013-04-22 16:52:07 +02:00
Russell Belfer
38eef6113d Make indexer use shared packfile open code
The indexer was creating a packfile object separately from the
code in pack.c which was a problem since I put a call to
git_mutex_init into just pack.c.  This commit updates the pack
function for creating a new pack object (i.e. git_packfile_check())
so that it can be used in both places and then makes indexer.c
use the shared initialization routine.

There are also a few minor formatting and warning message fixes.
2013-04-22 16:52:07 +02:00
Arkadiy Shapkin
10c06114cb Several warnings detected by static code analyzer fixed
Implicit type conversion argument of function to size_t type
Suspicious sequence of types castings: size_t -> int -> size_t
Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)'
Unsigned type is never < 0
2013-03-18 03:30:26 +04:00
Carlos Martín Nieto
0e040c031e indexer: use a hashtable for keeping track of offsets
These offsets are needed for REF_DELTA objects, which encode which
object they use as a base, but not where it lies in the packfile, so
we need a list.

These objects are mostly from older packfiles, before OFS_DELTA was
widely spread. The time spent in indexing these packfiles is greatly
reduced, though remains above what git is able to do.
2013-03-03 23:18:29 +01:00
Carlos Martín Nieto
447ae791e5 indexer: kill git_indexer
This was the first implementation and its goal was simply to have
something that worked. It is slow and now it's just taking up
space. Remove it and switch the one known usage to use the streaming
indexer.
2013-03-03 15:19:21 +01:00
Philip Kelley
2fe67aeb10 Fix a git_filebuf leak (fixes Win32 clone::can_cancel) 2013-02-14 08:46:58 -05:00
Ben Straub
def60ea473 Allow all non-zero returns to cancel transfers 2013-02-05 13:14:48 -08:00
Ben Straub
fe95ac1b67 Allow progress callback to cancel fetch
This works by having the indexer watch the return
code of the callback, so will only take effect
on object boundaries.
2013-02-05 10:59:58 -08:00
Carlos Martín Nieto
96c9b9f0e5 indexer: properly free the packfile resources
The indexer needs to call the packfile's free function so it takes care of
freeing the caches.

We still need to close the mwf descriptor manually so we can rename the
packfile into its final name on Windows.
2013-01-12 18:44:58 +01:00
Carlos Martín Nieto
80d647adc3 Revert "pack: packfile_free -> git_packfile_free and use it in the indexers"
This reverts commit f289f886cb, which
makes the tests fail on Windows. Revert until we can figure out a
solution.
2013-01-11 20:17:21 +01:00
nulltoken
090d5e1fda Fix MSVC compilation warnings 2013-01-11 19:30:59 +01:00
Carlos Martín Nieto
f289f886cb pack: packfile_free -> git_packfile_free and use it in the indexers
It turns out the indexers have been ignoring the pack's free function
and leaking data. Plug that.
2013-01-11 17:33:00 +01:00
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
nulltoken
bdb94c21fd Fix MSVC compilation warnings 2012-12-17 17:16:32 +01:00
Carlos Martín Nieto
6481a68d49 indexer: move the temporary buffers into the indexer object
Storing 4kB or 8kB in the stack is not very gentle. As this part has
to be linear, put the buffer into the indexer object so we allocate it
once in the heap.
2012-12-07 19:24:55 +01:00
Carlos Martín Nieto
3908c254aa indexer: correctly deal with objects larger than the window size
A mmap-window is not guaranteed to give you the whole object, but the
indexer currently assumes so.

Loop asking for more data until we've successfully CRC'd all of the
packed data.
2012-11-30 19:16:39 +01:00
Carlos Martín Nieto
5a3ad89dbd indexer: make use of streaming also for deltas
Up to now, deltas needed to be enterily in the packfile, and we tried
to decompress then in their entirety over and over again.

Adjust the logic so we read them as they come, just as we do for full
objects. This also allows us to simplify the logic and have less
nested code. The delta resolving phase still needs to decompress the
whole object into memory, as there is not yet any streaming
delta-apply support, but it helps in speeding up the downloading
process and reduces the amount of memory allocations we need to do.
2012-11-30 15:55:23 +01:00
Carlos Martín Nieto
f56f8585c0 indexer: use the packfile streaming API
The new API allows us to read the object bit by bit from the packfile,
instead of needing it all at once in the packfile. This also allows us
to hash the object as it comes in from the network instead of having
to try to read it all and failing repeatedly for larger objects.

This is only the first step, but it already shows huge improvements
when dealing with objects over a few megabytes in size. It reduces the
memory needs in some cases, but delta objects still need to be
completely in memory and the old inefficent method is still used for
that.
2012-11-30 15:55:23 +01:00
Ben Straub
839c5f574f API updates for indexer.h 2012-11-27 13:18:29 -08:00
Martin Woodward
826bc4a81b Remove use of English expletives
Remove words such as fuck, crap, shit etc.
Remove other potentially offensive words from comments.
Tidy up other geopolicital terms in comments.
2012-11-23 13:31:22 +00:00
Sascha Cunz
4cc7342e95 Indexer: Avoid a possible double-deletion in error case 2012-11-18 09:07:35 +01:00
Edward Thomson
603bee0791 Remove git_hash_ctx_new - callers now _ctx_init() 2012-11-13 10:23:05 -06:00
Edward Thomson
d6fb092409 Win32 CryptoAPI and CNG support for SHA1 2012-11-13 10:23:05 -06:00
Ben Straub
81eecc342b Fetch: don't clobber received count
This memset was being reached after the entire packfile under
WinHttp, so the byte count was being lost for small repos.
2012-10-29 13:34:14 -07:00
Ben Straub
7d222e1312 Network progress: rename things
git_indexer_stats and friends -> git_transfer_progress*

Also made git_transfer_progress members more sanely
named.
2012-10-24 13:29:14 -07:00
Ben Straub
909f626541 Indexing progress now goes to 100% 2012-10-19 19:36:23 -07:00
Ben Straub
216863c48f Fetch/indexer: progress callbacks 2012-10-19 19:36:22 -07:00
Michael Schubert
e3f8d58d12 indexer: do not require absolute path 2012-10-09 21:28:31 +02:00
Carlos Martín Nieto
2b175ca972 indexer: kill git_indexer_stats.data_received
It's not really needed with the current code as we have EOS and the
sideband's flush to tell us we're done.

Keep the distinction between processed and received objects.
2012-08-26 00:42:28 +02:00
Carlos Martín Nieto
7a57ae5478 indexer: don't segfault when freeing an unused indexer
Make sure that idx->pack isn't NULL before trying to free resources
under it.
2012-08-25 23:31:29 +02:00
Carlos Martín Nieto
bffa852f89 indexer: recognize and mark when all of the packfile has been downloaded
We can't always rely on the network telling us when the download is
finished. Recognize it from the indexer itself.
2012-08-24 19:01:10 +02:00
Carlos Martín Nieto
d1af70b050 indexer: delay resolving deltas
Not all delta bases are available on the first try. By delaying
resolving all deltas until the end, we avoid decompressing some of the
data twice or even more times, saving effort and time.
2012-07-14 22:29:11 +02:00
Carlos Martin Nieto
1d8943c640 mwindow: allow memory-window files to deregister
Once a file is registered, there is no way to deregister it, even
after the structure that contains it is no longer needed and has been
freed. This may be the source of #624.

Allow and use the deregister function to remove our file from the
global list.
2012-06-28 12:10:33 +02:00
Carlos Martín Nieto
371599576a indexer: don't use '/objects/pack/' unconditionally
Not everyone who indexes a packfile wants to put it in the standard
git repository location.
2012-06-28 10:24:03 +02:00
Michael Schubert
f9fd710581 indexer: start parsing input data immediately
Currently, the first call of git_indexer_stream_add adds the data to the
underlying pack file and opens it for later use, but doesn't start
parsing the already available data.
This means, git_indexer_stream_finalize only works if
git_indexer_stream_add was called at least twice. Kill this limitation
by parsing available data immediately.
2012-06-25 15:38:36 +02:00
Chris Young
a21bb1aa33 Merge remote-tracking branch 'source/development' into development 2012-06-13 23:28:51 +01:00
Chris Young
2aeadb9c78 Actually do the mmap... unsurprisingly, this makes the indexer work on SFS
On RAM: the .idx and .pack files become links to a .lock and the original download respectively.
Assume some feature (such as record locking) supported by SFS but not JXFS or RAM: is required.
2012-06-12 19:25:09 +01:00
Vicent Martí
3f0358604e misc: Fix warnings from PVS Studio trial 2012-06-07 22:43:48 +02:00
Michael Schubert
54db1a18df Cleanup
* indexer: remove leftover printf

* commit: remove unused macros COMMIT_BASIC_PARSE, COMMIT_FULL_PARSE
  and COMMIT_PRINT
2012-05-19 18:49:32 +02:00
Vicent Martí
904b67e69f errors: Rename error codes 2012-05-18 01:48:50 +02:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Carlos Martín Nieto
6a9d61ef50 indexer: add more consistency checks
Error out in finalize if there is junk after the packfile hash or we
couldn't process all the objects.
2012-05-16 01:22:25 +02:00
Carlos Martín Nieto
73d87a091c Introduce GITERR_INDEXER 2012-05-15 21:42:20 +02:00
Carlos Martín Nieto
a640d79e84 indexer: close the pack's fd before renaming it
Windows gets upset if we rename a file with an open descriptor.
2012-05-09 13:11:50 +02:00
nulltoken
fa6420f73e buf: deploy git_buf_len() 2012-04-30 07:12:37 +02:00
Russell Belfer
821f6bc740 Fix Win32 warnings 2012-04-26 13:04:54 -07:00
Carlos Martín Nieto
dee5515a23 transports: buffer the git requests before sending them
Trying to send every single line immediately won't give us any speed
improvement and duplicates the code we need for other transports. Make
the git transport use the same buffer functions as HTTP.
2012-04-25 12:44:27 +02:00
Carlos Martín Nieto
1c9c081a6a indexer: add git_indexer_stream_free() and _hash() 2012-04-13 22:19:45 +02:00