summaryrefslogtreecommitdiff
path: root/src/indexer.c
Commit message (Collapse)AuthorAgeFilesLines
* Reorder some khash declarationsCarlos Martín Nieto2015-03-111-0/+2
| | | | | | Keep the definitions in the headers, while putting the declarations in the C files. Putting the function definitions in headers causes them to be duplicated if you include two headers with them.
* win32: remember to cleanup our hash_ctxEdward Thomson2014-12-091-0/+1
|
* Fix for misleading "missing delta bases" error - Fix #2721.Ravindra Patel2014-11-211-2/+3
|
* Fix for memory leak issue in indexer.c, that surfaces on windowsRavindra Patel2014-11-191-6/+6
|
* Merge commit 'refs/pull/2366/head' of github.com:libgit2/libgit2Carlos Martín Nieto2014-10-271-4/+8
|\
| * Fix compiler warning (git_off_t cast to size_t).Albert Meltzer2014-05-191-4/+8
| | | | | | | | | | | | Use size_t for page size, instead of long. Check result of sysconf. Use size_t for page offset so no cast to size_t (second arg to p_mmap). Use mod instead div/mult pair, so no cast to size_t is necessary.
* | Properly report failure when expanding a packfileWilliam Swanson2014-07-091-1/+1
| |
* | Fix assert when receiving uncommon sideband packetPhilip Kelley2014-06-271-0/+5
| |
* | Share packs across repository instancescmn/global-mwfCarlos Martín Nieto2014-06-231-1/+8
|/ | | | | | | | | | | Opening the same repository multiple times will currently open the same file multiple times, as well as map the same region of the file multiple times. This is not necessary, as the packfile data is immutable. Instead of opening and closing packfiles directly, introduce an indirection and allocate packfiles globally. This does mean locking on each packfile open, but we already use this lock for the global mwindow list so it doesn't introduce a new contention point.
* Fix warning on uninitialized variable.Albert Meltzer2014-05-181-1/+1
|
* indexer: mmap fixes for Windowscmn/indexer-mmapCarlos Martín Nieto2014-05-171-1/+3
| | | | | | | | | | | Windows has its own ftruncate() called _chsize_s(). p_mkstemp() is changed to use p_open() so we can make sure we open for writing; the addition of exclusive create is a good thing to do regardless, as we want a temporary path for ourselves. Lastly, MSVC doesn't quite know how to add two numbers if one of them is a void pointer, so let's alias it to unsigned char.C
* indexer: use mmap for writingCarlos Martín Nieto2014-05-171-72/+82
| | | | | | Some OSs cannot keep their ideas about file content straight when mixing standard IO with file mapping. As we use mmap for reading from the packfile, let's make writing to the pack file use mmap.
* Initialize local variableLinquize2014-05-131-1/+1
|
* indexer: avoid memory movescmn/indexer-vector-handlingCarlos Martín Nieto2014-05-081-8/+15
| | | | | | | | | | Our vector does a move of the rest of the array when we remove an item. Doing this repeatedly can be expensive, and we do this a lot in the indexer. Instead, set the value to NULL and skip those entries. perf reported around 30% of `index-pack` time was going into memmove. With this change, that goes away and we spent most of the time hashing and inflating data.
* Don't redefine the same callback types, their signatures may changeJacques Germishuys2014-04-211-2/+2
|
* Some fixes for Windows x64 warningsRussell Belfer2014-01-301-1/+1
|
* Merge pull request #2043 from arthurschreiber/arthur/fix-memory-leaksVicent Marti2014-01-141-7/+12
|\ | | | | Fix a bunch of memory leaks.
| * Incorporate @arrbee's suggestions.Arthur Schreiber2014-01-141-14/+12
| |
| * Incorporate @ethomson's suggestions.Arthur Schreiber2014-01-131-16/+15
| |
| * Fix a memory leak in `hash_and_save` and `inject_object`.Arthur Schreiber2014-01-131-4/+12
| |
* | Refactor zlib for easier deflate streamingEdward Thomson2014-01-141-4/+2
|/
* Cleanups, renames, and leak fixesRussell Belfer2013-12-121-2/+2
| | | | | | | | | This renames git_vector_free_all to the better git_vector_free_deep and also contains a couple of memory leak fixes based on valgrind checks. The fixes are specifically: failure to free global dir path variables when not compiled with threading on and failure to free filters from the filter registry that had not be initialized fully.
* Test cancel from indexer progress callbackRussell Belfer2013-12-111-13/+15
| | | | | | | | | | | | | | | This adds tests that try canceling an indexer operation from within the progress callback. After writing the tests, I wanted to run this under valgrind and had a number of errors in that situation because mmap wasn't working. I added a CMake option to force emulation of mmap and consolidated the Amiga-specific code into that new place (so we don't actually need separate Amiga code now, just have to turn on -DNO_MMAP). Additionally, I made the indexer code propagate error codes more reliably than it used to.
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-1/+1
|
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Add git_vector_free_allRussell Belfer2013-12-111-15/+5
| | | | | | There are a lot of places that we call git__free on each item in a vector and then call git_vector_free on the vector itself. This just wraps that up into one convenient helper function.
* Further EUSER and error propagation fixesRussell Belfer2013-12-111-4/+2
| | | | | | | | | | | | | This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
* Updates to cancellation logic during download and indexing of packfile.Jameson Miller2013-12-021-11/+17
|
* Allow callers to set mode on packfile creationEdward Thomson2013-11-071-2/+5
|
* move mode_t to filebuf_open instead of _commitEdward Thomson2013-11-041-4/+6
|
* Merge pull request #1933 from libgit2/vmg/gcc-warningsRussell Belfer2013-11-011-1/+1
|\ | | | | Warnings for Windows x64 (MSVC) and GCC on Linux
| * pack: `__object_header` always returns unsigned valuesVicent Marti2013-11-011-2/+1
| |
| * Fix warning on win64Linquize2013-11-011-2/+3
| |
* | indexer: remove the stream infixCarlos Martín Nieto2013-10-301-26/+26
|/ | | | | | | | | | | It was there to keep it apart from the one which read in from a file on disk. This other indexer does not exist anymore, so there is no need for anything other than git_indexer to refer to it. While here, rename _add() function to _append() and _finalize() to _commit(). The former change is cosmetic, while the latter avoids talking about "finalizing", which OO languages use to mean something completely different.
* Merge pull request #1891 from libgit2/cmn/fix-thin-packsVicent Martí2013-10-281-41/+276
|\ | | | | Add support for thin packs
| * indexer: include the delta statsCarlos Martín Nieto2013-10-231-0/+6
| | | | | | | | | | | | | | | | | | | | The user is unable to derive the number of deltas in the pack, as that would require them to capture the stats exactly in the moment between download and final processing, which is abstracted away in the fetch. Capture these numbers for the user and expose them in the progress struct. The clone and fetch examples now also present this information to the user.
| * indexer: clearer stats for thin packsCarlos Martín Nieto2013-10-111-3/+2
| | | | | | | | | | | | | | Don't increase the number of total objects, as it can produce suprising progress output. The only addition compared to pre-thin is the addition of local_objects to allow an output similar to git's "completed with %d local objects".
| * indexer: inject one base at a timeCarlos Martín Nieto2013-10-081-27/+37
| | | | | | | | | | | | | | There may be multiple deltas referencing the same base as well as OFS deltas which rely on a thin delta. Deal with both at the same time by injecting a single object and going back up to the main delta-resolving loop.
| * indexer: fix thin packsCarlos Martín Nieto2013-10-041-37/+239
| | | | | | | | | | | | When given an ODB from which to read objects, the indexer will attempt to inject the missing bases at the end of the pack and update the header and trailer to reflect the new contents.
| * indexer: do multiple passes over the delta listCarlos Martín Nieto2013-10-041-12/+30
| | | | | | | | | | | | | | | | | | Though unusual, a packfile may contain a delta whose base is a delta that comes later. In order index such a packfile, we must not give up on the first failure to resolve a delta, but keep it around. If there is a pass which makes no progress, this indicates that the packfile is broken, so fail accordingly.
* | Clean up annoying warningsRussell Belfer2013-10-031-5/+5
| | | | | | | | | | | | | | The indexer code was generating warnings on Windows 64-bit. I looked closely at the logic and was able to simplify it a bit. Also this fixes some other Windows and Linux warnings.
* | Support cancellation in push operationJameson Miller2013-10-021-0/+1
|/ | | | | | | | | | | | | | | | This commit adds cancellation for the push operation. This work consists of: 1) Support cancellation during push operation - During object counting phase - During network transfer phase - Propagate GIT_EUSER error code out to caller 2) Improve cancellation support during fetch - Handle cancellation request during network transfer phase - Clear error string when cancelled during indexing 3) Fix error handling in git_smart__download_pack Cancellation during push is still only handled in the pack building and network transfer stages of push (and not during packbuilding).
* Fix warningsnulltoken2013-09-261-1/+1
|
* msvc: No void* arithmetic on WindowsVicent Marti2013-09-181-1/+1
|
* indexer: don't reiterate the class in the messageCarlos Martín Nieto2013-09-181-3/+3
|
* indexer: check the packfile trailer for correctnessCarlos Martín Nieto2013-09-181-17/+69
| | | | | The packfile trailer gets sent over and we should check whether it's correct as part of our sanity checks of the packfile.
* index: fix potential memory leaksRémi Duraffort2013-07-151-1/+1
|
* Add helpful buffer shorten functionRussell Belfer2013-07-011-1/+1
|
* calloc() to initialize memoryLinquize2013-05-161-2/+2
|
* Make git_oid_cmp public and add git_oid__cmpRussell Belfer2013-04-291-2/+2
|