summaryrefslogtreecommitdiff
path: root/src/odb.c
Commit message (Collapse)AuthorAgeFilesLines
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-7/+7
|
* errors: Rename the generic return codesVicent Martí2012-05-181-12/+12
|
* Handle duplicate objects from different backends in git_odb_read_prefix().Han-Wen Nienhuys2012-05-121-10/+15
|
* Fix valgrind issuesRussell Belfer2012-05-041-3/+9
| | | | | | | There are three changes here: - correctly propogate error code from failed object lookups - make zlib inflate use our allocators - add OID to notfound error in ODB lookups
* Implement git_pool paged memory allocatorRussell Belfer2012-04-251-1/+1
| | | | | | | | | | | | | | | | | | This adds a `git_pool` object that can do simple paged memory allocation with free for the entire pool at once. Using this, you can replace many small allocations with large blocks that can then cheaply be doled out in small pieces. This is best used when you plan to free the small blocks all at once - for example, if they represent the parsed state from a file or data stream that are either all kept or all discarded. There are two real patterns of usage for `git_pools`: either for "string" allocation, where the item size is a single byte and you end up just packing the allocations in together, or for "fixed size" allocation where you are allocating a large object (e.g. a `git_oid`) and you generally just allocation single objects that can be tightly packed. Of course, you can use it for other things, but those two cases are the easiest.
* Convert indexer, notes, sha1_lookup, and signatureRussell Belfer2012-03-191-0/+4
| | | | More files moved to new error handling style.
* Continue error conversionRussell Belfer2012-03-141-3/+1
| | | | | | | This converts blob.c, fileops.c, and all of the win32 files. Also, various minor cleanups throughout the code. Plus, in testing the win32 build, I cleaned up a bunch (although not all) of the warnings with the 64-bit build.
* Migrate ODB files to new error handlingRussell Belfer2012-03-121-56/+57
| | | | | | | | | | | | | | This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
* Fix issues raised on pull requestRussell Belfer2012-03-071-6/+2
| | | | This resolves the comments on pull request #590
* Migrating diff to new error handlingRussell Belfer2012-03-061-113/+84
| | | | | | Ended up migrating a bunch of upstream functions as well including vector, attr_file, and odb in order to get this to work right.
* error-handling: ReferencesVicent Martí2012-03-061-1/+1
| | | | | Yes, this is error handling solely for `refs.c`, but some of the abstractions leak all ofer the code base.
* buffer: Unify `git_fbuffer` and `git_buf`Vicent Martí2012-02-271-3/+4
| | | | | | | | | | | | | | This makes so much sense that I can't believe it hasn't been done before. Kill the old `git_fbuffer` and read files straight into `git_buf` objects. Also: In order to fully support 4GB files in 32-bit systems, the `git_buf` implementation has been changed from using `ssize_t` for storage and storing negative values on allocation failure, to using `size_t` and changing the buffer pointer to a magical pointer on allocation failure. Hopefully this won't break anything.
* Fix warnings about type conversion on win32Russell Belfer2012-02-231-2/+2
|
* zlib: Remove custom `git2/zlib.h` headerVicent Martí2012-02-151-1/+1
| | | | | | This is legacy compat stuff for when `deflateBound` is not defined, but we're not embedding zlib and that function is always available. Kill that with fire.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* odb: Proper symlink hashingVicent Martí2012-02-101-0/+42
|
* odb: Add internal `git_odb__hashfd`Vicent Martí2012-02-101-22/+28
|
* Move path related functions from fileops to pathRussell Belfer2012-01-171-1/+1
| | | | | | | | | | | This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-10/+17
| | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* Rename all `_close` methodsVicent Marti2011-11-261-4/+4
| | | | | There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
* repository: Change ownership semanticsVicent Marti2011-11-261-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-11/+11
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* odb: Let users decide compression level for the loose ODBVicent Marti2011-09-291-1/+1
|
* Tabify everythingVicent Marti2011-09-191-2/+2
| | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* Cleanup legal dataVicent Marti2011-09-191-21/+3
| | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* posix: Properly handle `snprintf` in all platformsVicent Marti2011-08-181-4/+2
|
* odb: Do not pass around a header when hashingVicent Marti2011-08-181-10/+7
|
* Fix MSVC compilation warningnulltoken2011-07-091-1/+1
|
* status: CleanupVicent Marti2011-07-091-4/+50
| | | | | | | | The `hashfile` function has been moved to ODB, next to `git_odb_hash`. Global state has been removed from the dirent call in `status.c`, because global state is killing the rainforest and causing global warming.
* vector: Timsort all of the thingsVicent Marti2011-07-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Drop the GLibc implementation of Merge Sort and replace it with Timsort. The algorithm has been tuned to work on arrays of pointers (void **), so there's no longer a need to abstract the byte-width of each element in the array. All the comparison callbacks now take pointers-to-elements, not pointers-to-pointers, so there's now one less level of dereferencing. E.g. int index_cmp(const void *a, const void *b) { - const git_index_entry *entry_a = *(const git_index_entry **)(a); + const git_index_entry *entry_a = (const git_index_entry *)(a); The result is up to a 40% speed-up when sorting vectors. Memory usage remains lineal. A new `bsearch` implementation has been added, whose callback also supplies pointer-to-elements, to uniform the Vector API again.
* fileops: CleanupVicent Marti2011-07-051-6/+6
| | | | | | | | | | | | | | | | Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix.
* cleanup: remove trailing spacesKirill A. Shutemov2011-07-011-1/+1
| | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* odb: Add GIT_EPASSTHROUGHVicent Marti2011-06-191-17/+25
| | | | | Allows a custom user backend to passthrough one of the callbacks. Used for e.g. caching backends.
* odb: Fix loading ODB alternatesVicent Marti2011-06-031-4/+16
| | | | | Fixed an issue with the `strtokz implementation and added support for comments and relative paths in the alternates file.
* Merge pull request #144 from nordsturm/fix_fakewstreamVicent Martí2011-06-021-1/+1
|\ | | | | Fix fake wstream write
| * Fix whole buffer writing in fake wstreamSergey Nikishin2011-04-241-1/+1
| |
* | short-oid: CleanupVicent Marti2011-06-011-7/+7
| |
* | Fixed some error messages related to searching objects from a short oid. ↵Marc Pegon2011-06-011-4/+15
| | | | | | | | Fixed forgot to check that prefix length is greater than minimum prefix length in read_unique_short_oid method from pack backend.
* | Added git.git sha1 lookup method to replace simple binary search in pack ↵Marc Pegon2011-06-011-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | backend. Implemented find_unique_short_oid for pack backend, based on git sha1 lookup method; finding an object given its full oid is just a particular case of searching the unique object matching an oid prefix (short oid). Added git_odb_read_unique_short_oid, which iterates over all the backends to find and read the unique object matching the given oid prefix. Added a git_object_lookup_short_oid method to find the unique object in the repository matching a given oid prefix : it generalizes git_object_lookup which now does nothing but calls git_object_lookup_short_oid.
* | odb: Reword errorsVicent Marti2011-05-231-5/+5
| |
* | odb.c: Move to new error handling mechanismJakob Pfender2011-05-231-17/+21
| |
* | Move odb.c to the new error handlingschu2011-05-181-19/+24
| | | | | | | | | | | | Add missing free in git_odb_new(). Signed-off-by: schu <schu-github@schulog.org>
* | Check error code from `git_cache_init`Vicent Marti2011-05-151-3/+3
| |
* | Merge pull request #184 from nulltoken/repo-error-handlingVicent Martí2011-05-151-1/+5
|\ \ | | | | | | Updated fileops.c and repository.c to new error handling mechanism
| * | Move cache.c to the new error handlingnulltoken2011-05-151-1/+5
| | |
* | | fix git_otype typo when calling `git_odb_read_header`.Shuhei Tanuma2011-05-151-1/+1
|/ /
* | odb backend_sort_cmp should be staticCarlos Martín Nieto2011-05-061-1/+1
|/ | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Add a fake wstream to the ODBVicent Marti2011-04-041-0/+65
| | | | | | | Streaming writes will no longer fail when writing to a backend that doesn't support streaming writes but supports direct ones. Now we create a fake stream on memory and then write it as a single block using the backend `write` callback.
* Improve the ODB writing backendVicent Marti2011-03-231-0/+35
| | | | | | | | | Temporary files when doing streaming writes are now stored inside the Objects folder, to prevent issues when moving files between disks/partitions. Add support for block writes to the ODB again (for those backends that cannot implement streaming).
* Add getters for `git_odb_object`Vicent Marti2011-03-221-0/+20
|